3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = [ 'k'=> 'john', 'd' => 'doe']; var_dump( array_map(function ($item, $b){ return $item; }, $test) );
Output for 7.1.0 - 7.3.0beta2
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /in/1VGW0:8 Stack trace: #0 [internal function]: {closure}('john') #1 /in/1VGW0(10): array_map(Object(Closure), Array) #2 {main} thrown in /in/1VGW0 on line 8
Process exited with code 255.
Output for 5.6.30, 7.0.28 - 7.0.31
Warning: Missing argument 2 for {closure}() in /in/1VGW0 on line 8 Warning: Missing argument 2 for {closure}() in /in/1VGW0 on line 8 array(2) { ["k"]=> string(4) "john" ["d"]=> string(3) "doe" }
Output for hhvm-3.22.0
Warning: __invoke() expects exactly 2 parameters, 1 given in /in/1VGW0 on line -1 Warning: __invoke() expects exactly 2 parameters, 1 given in /in/1VGW0 on line -1 array(2) { ["k"]=> string(4) "john" ["d"]=> string(3) "doe" }
Output for hhvm-3.18.5 - 3.21.3
Warning: __invoke() expects exactly 2 parameters, 1 given in /in/1VGW0 on line 9 Warning: __invoke() expects exactly 2 parameters, 1 given in /in/1VGW0 on line 9 array(2) { ["k"]=> string(4) "john" ["d"]=> string(3) "doe" }