3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class test{ const X = 10; static function dotest(){ $arr = array(0 => 5, 1=>12, 2=>7, 3=>5, 4, 13); $valid = array_filter( $arr, function( $item, $ttl ) { return ( $item < $ttl); }, self::X ); var_dump($valid); } } test::dotest();
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function test::{closure}(), 1 passed and exactly 2 expected in /in/DUBpB:10 Stack trace: #0 [internal function]: test::{closure}(5) #1 /in/DUBpB(12): array_filter(Array, Object(Closure), 10) #2 /in/DUBpB(17): test::dotest() #3 {main} thrown in /in/DUBpB on line 10
Process exited with code 255.
Output for 5.6.8 - 5.6.28, 7.0.0 - 7.0.14
Warning: Missing argument 2 for test::{closure}() in /in/DUBpB on line 10 Notice: Undefined variable: ttl in /in/DUBpB on line 11 Warning: Missing argument 2 for test::{closure}() in /in/DUBpB on line 10 Notice: Undefined variable: ttl in /in/DUBpB on line 11 Warning: Missing argument 2 for test::{closure}() in /in/DUBpB on line 10 Notice: Undefined variable: ttl in /in/DUBpB on line 11 Warning: Missing argument 2 for test::{closure}() in /in/DUBpB on line 10 Notice: Undefined variable: ttl in /in/DUBpB on line 11 Warning: Missing argument 2 for test::{closure}() in /in/DUBpB on line 10 Notice: Undefined variable: ttl in /in/DUBpB on line 11 Warning: Missing argument 2 for test::{closure}() in /in/DUBpB on line 10 Notice: Undefined variable: ttl in /in/DUBpB on line 11 array(0) { }
Output for hhvm-3.10.0 - 3.12.0
Warning: __invoke() expects exactly 2 parameters, 1 given in /in/DUBpB on line 11 Notice: Undefined variable: ttl in /in/DUBpB on line 11 Warning: __invoke() expects exactly 2 parameters, 1 given in /in/DUBpB on line 11 Notice: Undefined variable: ttl in /in/DUBpB on line 11 Warning: __invoke() expects exactly 2 parameters, 1 given in /in/DUBpB on line 11 Notice: Undefined variable: ttl in /in/DUBpB on line 11 Warning: __invoke() expects exactly 2 parameters, 1 given in /in/DUBpB on line 11 Notice: Undefined variable: ttl in /in/DUBpB on line 11 Warning: __invoke() expects exactly 2 parameters, 1 given in /in/DUBpB on line 11 Notice: Undefined variable: ttl in /in/DUBpB on line 11 Warning: __invoke() expects exactly 2 parameters, 1 given in /in/DUBpB on line 11 Notice: Undefined variable: ttl in /in/DUBpB on line 11 array(0) { }
Output for 5.3.0 - 5.5.35
Warning: array_filter() expects at most 2 parameters, 3 given in /in/DUBpB on line 12 NULL
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/DUBpB on line 10
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/DUBpB on line 10
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/DUBpB on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/DUBpB on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/DUBpB on line 5
Process exited with code 255.