3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(array_map(function ($a, $b) {return "$b => $a";}, array_filter(['a' => 'b', 1 => 'abc', 'c' => false, 'd' => null, 'e' => 0, 'f' => 'z'])));
based on rFmpl
Output for 7.1.0 - 7.3.0rc4
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /in/MQ0Lp:3 Stack trace: #0 [internal function]: {closure}('b') #1 /in/MQ0Lp(3): array_map(Object(Closure), Array) #2 {main} thrown in /in/MQ0Lp on line 3
Process exited with code 255.
Output for 5.5.0 - 7.0.20
Warning: Missing argument 2 for {closure}() in /in/MQ0Lp on line 3 Notice: Undefined variable: b in /in/MQ0Lp on line 3 Warning: Missing argument 2 for {closure}() in /in/MQ0Lp on line 3 Notice: Undefined variable: b in /in/MQ0Lp on line 3 Warning: Missing argument 2 for {closure}() in /in/MQ0Lp on line 3 Notice: Undefined variable: b in /in/MQ0Lp on line 3 array(3) { ["a"]=> string(5) " => b" [1]=> string(7) " => abc" ["f"]=> string(5) " => z" }