3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //Enter your code here, enjoy! $array = array("1" => "PHP code tester Sandbox Online", "foo" => "bar", 5 , 5 => 89009, "case" => "Random Stuff", "PHP Version" => phpversion() ); $a = array_filter( $array, function($e){ return $e=='1'; }, ARRAY_FILTER_USE_KEY ); var_dump($a);
based on WDiFY
Output for 5.6.0 - 7.2.0
array(1) { [1]=> string(30) "PHP code tester Sandbox Online" }
Output for 5.3.0 - 5.5.38
Notice: Use of undefined constant ARRAY_FILTER_USE_KEY - assumed 'ARRAY_FILTER_USE_KEY' in /in/GM6mR on line 13 Warning: array_filter() expects at most 2 parameters, 3 given in /in/GM6mR on line 13 NULL
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/GM6mR on line 11
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 T_FUNCTION in /in/GM6mR on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/GM6mR on line 11
Process exited with code 255.