Intermediate PHP
Q46 / 100

What does PHP's array_map() do?

Correct! Well done.

Incorrect.

The correct answer is B) Applies a callback to each element and returns a new array of results

B

Correct Answer

Applies a callback to each element and returns a new array of results

Explanation

array_map(fn($x) => $x * 2, [1,2,3]) returns [2,4,6]. For filtering use array_filter(); for reducing use array_reduce().

Progress
46/100