3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = array('key' => 'value'); print_r(array_filter($test, function($key, $value){ return $value == 'value';}), function($key, $value){ return $value; } );
based on Q9d6D
Output for 7.1.0 - 7.3.0rc3
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /in/Y843a:5 Stack trace: #0 [internal function]: {closure}('value') #1 /in/Y843a(5): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/Y843a on line 5
Process exited with code 255.
Output for 7.0.30
Warning: Missing argument 2 for {closure}() in /in/Y843a on line 5 Notice: Undefined variable: value in /in/Y843a on line 5 Warning: print_r() expects parameter 2 to be boolean, object given in /in/Y843a on line 6
Output for hhvm-3.22.0
Warning: __invoke() expects exactly 2 parameters, 1 given in /in/Y843a on line -1 Notice: Undefined variable: value in /in/Y843a on line -1 Warning: print_r() expects parameter 2 to be boolean, object given in /in/Y843a on line -1
Output for hhvm-3.18.5 - 3.21.3
Warning: __invoke() expects exactly 2 parameters, 1 given in /in/Y843a on line 5 Notice: Undefined variable: value in /in/Y843a on line 5 Warning: print_r() expects parameter 2 to be boolean, object given in /in/Y843a on line 7
Output for 5.6.30
Warning: Missing argument 2 for {closure}() in /in/Y843a on line 5 Notice: Undefined variable: value in /in/Y843a on line 5 Warning: print_r() expects parameter 2 to be boolean, object given in /in/Y843a on line 7