- array_filter: documentation ( source)
<?php
$x = array(
1,
2,
true,
null, //will be removed
'', //will be removed
false, //will be removed
0, //will be removed
array(), //will be removed
'finish'
);
foreach(array_filter($x, function($v){ echo $v; return true; }) as $b)
{}