3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php var_dump(array_filter([1, 2,], function($v, $k) { var_dump($v, $k); return true; }));
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /in/J4AvL:3 Stack trace: #0 [internal function]: {closure}(1) #1 /in/J4AvL(3): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/J4AvL on line 3
Process exited with code 255.
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.0.14
Warning: Missing argument 2 for {closure}() in /in/J4AvL on line 3 Notice: Undefined variable: k in /in/J4AvL on line 3 int(1) NULL Warning: Missing argument 2 for {closure}() in /in/J4AvL on line 3 Notice: Undefined variable: k in /in/J4AvL on line 3 int(2) NULL array(2) { [0]=> int(1) [1]=> int(2) }
Output for hhvm-3.12.0
Warning: __invoke() expects exactly 2 parameters, 1 given in /in/J4AvL on line -1 Notice: Undefined variable: k in /in/J4AvL on line -1 int(1) NULL Warning: __invoke() expects exactly 2 parameters, 1 given in /in/J4AvL on line -1 Notice: Undefined variable: k in /in/J4AvL on line -1 int(2) NULL array(2) { [0]=> int(1) [1]=> int(2) }
Output for hhvm-3.10.0
Warning: __invoke() expects exactly 2 parameters, 1 given in /in/J4AvL on line 3 Notice: Undefined variable: k in /in/J4AvL on line 3 int(1) NULL Warning: __invoke() expects exactly 2 parameters, 1 given in /in/J4AvL on line 3 Notice: Undefined variable: k in /in/J4AvL on line 3 int(2) NULL array(2) { [0]=> int(1) [1]=> int(2) }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/J4AvL on line 3
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 '[', expecting ')' in /in/J4AvL on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/J4AvL on line 3
Process exited with code 255.