More elegant way to do this?
Posted: Mon Jul 26, 2010 9:49 am
There must me a more elegant way to do this.. It seems cumbersome and winded. I was wondering if anyone had a suggestion for creating the final keyed array.
Thanks for the tutelage.
Code: Select all
$occupants = array();
foreach ($targets as $target){
if (target_is_concealed($target)){ //simply returns true or false.
$hidden[] = $target;
}
else{
$nothidden[] =$target;
}
}
$occupants['hidden'] = $hidden;
$occupants['nothidden'] = $nothidden;
return $occupants;