3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array(0 => array("id"=>1,"name"=>"cat 1"), 1 => array("id"=>2,"name"=>"cat 2"), 2 => array("id"=>3,"name"=>"cat 1") ); $arr = array_filter($arr, function($ar) { return ($ar['name'] == 'cat 1'); //return ($ar['name'] == 'cat 1' AND $ar['id'] == '3');// you can add multiple conditions }); echo "<pre>"; print_r($arr);
Output for 5.3.0 - 7.1.0
<pre>Array ( [0] => Array ( [id] => 1 [name] => cat 1 ) [2] => Array ( [id] => 3 [name] => cat 1 ) )
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/KSo6F on line 6
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/KSo6F on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/KSo6F on line 6
Process exited with code 255.