3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function test_cat($ar){ return($ar['name'] == 'cat 1'); } $arr = array(0 => array("id"=>1,"name"=>"cat 1"), 1 => array("id"=>2,"name"=>"cat 2"), 2 => array("id"=>3,"name"=>"cat 1") ); $arr2 = array_filter($arr, "test_cat"); echo "<pre>"; print_r($arr2);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<pre>Array ( [0] => Array ( [id] => 1 [name] => cat 1 ) [2] => Array ( [id] => 3 [name] => cat 1 ) )