D. The separator and array parameters are swapped in implode.
Solution
Step 1: Check parameter order in implode
implode expects separator first, then array second.
Step 2: Analyze given code
Code uses implode($fruits, ', '); which swaps parameters.
Final Answer:
The separator and array parameters are swapped in implode. -> Option D
Quick Check:
Parameter order matters in implode [OK]
Hint: Separator first, array second in implode [OK]
Common Mistakes:
Swapping parameters order
Assuming implode works like explode
Using wrong variable names
5. You have an array $words = ['one', '', 'three', null, 'five'];. You want to join only the non-empty, non-null elements with a comma. Which code correctly does this?
hard
A. $filtered = array_filter($words); echo implode(', ', $filtered);
B. echo implode(', ', $words);
C. $filtered = array_map(trim, $words); echo implode(', ', $filtered);