3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $_arr = ['test1', 'test2', 'test3']; $_string = 'TestWalk'; print "<pre>"; print_r(array_map(function($_string, $person) { return $_string . $person; }, $_arr));
Output for 7.1.0
<pre> Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /in/ZINMd:5 Stack trace: #0 [internal function]: {closure}('test1') #1 /in/ZINMd(5): array_map(Object(Closure), Array) #2 {main} thrown in /in/ZINMd on line 5
Process exited with code 255.
Output for 5.4.0 - 7.0.14
<pre> Warning: Missing argument 2 for {closure}() in /in/ZINMd on line 5 Notice: Undefined variable: person in /in/ZINMd on line 5 Warning: Missing argument 2 for {closure}() in /in/ZINMd on line 5 Notice: Undefined variable: person in /in/ZINMd on line 5 Warning: Missing argument 2 for {closure}() in /in/ZINMd on line 5 Notice: Undefined variable: person in /in/ZINMd on line 5 Array ( [0] => test1 [1] => test2 [2] => test3 )
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ZINMd on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/ZINMd on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ZINMd on line 2
Process exited with code 255.