Skip to main content
PHP Code Completion Hard +35 XP

Array Map

Complete the array_map call to double values.

PHPFill in the blank
$doubled = array_map(fn($n) => $n * 2, ___);

Type the missing code

Show answer and explanation

Answer: $numbers

array_map applies a callback to each element of an array. The array is the second argument.

Hint: array_map needs an array to operate on.

What this challenge tests

Code Completion in PHP: arrays, functional.

Related challenges