Bird
0
0

What will explode('-', '2024-06-15') return?

easy📝 Conceptual Q2 of 15
PHP - String Functions
What will explode('-', '2024-06-15') return?
A['2024', '06', '15']
B['2024-06-15']
C['2024', '-06', '-15']
D['2024', '06-15']
Step-by-Step Solution
Solution:
  1. Step 1: Identify the delimiter and string

    The delimiter is '-', so the string '2024-06-15' is split at each '-'.
  2. Step 2: Split the string by delimiter

    Splitting results in ['2024', '06', '15'] as each part between '-' is extracted.
  3. Final Answer:

    ['2024', '06', '15'] -> Option A
  4. Quick Check:

    explode('-', string) splits at '-' correctly [OK]
Quick Trick: Delimiter splits string into parts in explode() [OK]
Common Mistakes:
  • Expecting explode to keep delimiters
  • Wrong array parts due to delimiter confusion
  • Using wrong delimiter character

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes