Intermediate
PHP
Q59 / 100
What is the difference between array_merge() and array + array?
Correct! Well done.
Incorrect.
The correct answer is B) array_merge renumbers numeric keys and overwrites string keys; + keeps the first array's values for duplicate keys
B
Correct Answer
array_merge renumbers numeric keys and overwrites string keys; + keeps the first array's values for duplicate keys
Explanation
[1,2] + [3,4,5] = [1,2,5] (+ keeps first values for existing keys). array_merge([1,2],[3,4,5]) = [1,2,3,4,5] (appends).
Progress
59/100