3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ 'name' => [ 'Ace', 'James', 'Tommy' ], 'age' => [ 10, 20, 32 ] ]; $mainData = [ 'people' => array_map(function ($key, $value) { var_dump($key, $value); }, $data) ];
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
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(17): array_map(Object(Closure), Array) #2 {main} thrown in /in/49i92 on line 17
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27
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.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 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

preferences:
166.98 ms | 402 KiB | 224 Q