[eluser]chefnelone[/eluser]
[quote author="dudeami0" date="1294198449"]You could wrap it in a condition, like:
Code:
$area = 'My area';
$matches = 0;
foreach($seccion as $seccion_data){
if($seccion_data->area == $area){
echo $seccion_data->name;
++$matches;
if ($matches >= 5)
break;
}
}
Btw, where is this array coming from? That might help with making a more efficient way of getting the results you want.[/quote]
but this just break the foreach when it find 5 matches....?¿
I'm looking fordward for a different thing, I just want to know how to get ride of the foreach() so that there is no need to loop the complete object...