3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $data = [ 'name' => [ 'Ace', 'James', 'Tommy' ], 'age' => [ 10, 20, 32 ] ]; $mainData = [ 'people' => array_map(function ($key, $value) { var_dump($key, $value); }, $data) ];
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /in/49i92:17 Stack trace: #0 [internal function]: {closure}(Array) #1 /in/49i92(19): array_map(Object(Closure), Array) #2 {main} thrown in /in/49i92 on line 17
Process exited with code 255.
Output for 5.4.12 - 7.0.20
Warning: Missing argument 2 for {closure}() in /in/49i92 on line 17 Notice: Undefined variable: value in /in/49i92 on line 18 array(3) { [0]=> string(3) "Ace" [1]=> string(5) "James" [2]=> string(5) "Tommy" } NULL Warning: Missing argument 2 for {closure}() in /in/49i92 on line 17 Notice: Undefined variable: value in /in/49i92 on line 18 array(3) { [0]=> int(10) [1]=> int(20) [2]=> int(32) } NULL
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/49i92 on line 3
Process exited with code 255.