3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $variable = Array( array( 'id'=>"1", 'file'=>"new" ), array( 'id'=>"2", 'file'=>"sample" ), array( 'id'=>"3", 'file'=>"new" ), array( 'id'=>"4", 'file'=>"garden" ), array( 'id'=>"5", 'file'=>"new" ), array( 'id'=>"6", 'file'=>"tem" ) ); foreach($variable AS $item) { if($item['file'] == "new") $newarray[] = $item; } print_r($newarray);
Output for 4.3.0 - 7.1.0
Array ( [0] => Array ( [id] => 1 [file] => new ) [1] => Array ( [id] => 3 [file] => new ) [2] => Array ( [id] => 5 [file] => new ) )