@ 2015-04-30T06:47:58Z <?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);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.6.0 - 5.6.25 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.25 , 7.3.0 - 7.3.12 , 7.4.0 array(1) {
[1]=>
string(30) "PHP code tester Sandbox Online"
}
Output for 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.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.1.6 , 5.2.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.3.11 , 4.4.0 - 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 . preferences:dark mode live preview
245.63 ms | 401 KiB | 261 Q