3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [1, 2, 3, 4]; $callable = function($value, $key, array &$output) { $output[$key] = $value * 100; }; $output = []; array_map($callable, $array, array_keys($array), $output); print_r($output);
based on hfc1I
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 3 passed to {closure}() must be of the type array, null given in /in/p3e4M:4 Stack trace: #0 [internal function]: {closure}(1, 0, NULL) #1 /in/p3e4M(9): array_map(Object(Closure), Array, Array, Array) #2 {main} thrown in /in/p3e4M on line 4
Process exited with code 255.
Output for 5.4.10 - 5.6.28
Catchable fatal error: Argument 3 passed to {closure}() must be of the type array, null given in /in/p3e4M on line 4
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/p3e4M on line 3
Process exited with code 255.