3v4l.org

run code in 300+ PHP versions simultaneously
<?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'])));
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 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/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 - 5.5.36, 5.6.0 - 5.6.28, 7.0.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" }

preferences:
197.74 ms | 402 KiB | 214 Q