If you want to run through large arrays don't use count() function in the loops , its a over head in performance, copy the count() value into a variable and use that value in loops for a better performance.
Eg:
// Bad approach
for($i=0;$i<count($some_arr);$i++)
{
// calculations
}
// Good approach
$arr_length = count($some_arr);
for($i=0;$i<$arr_length;$i++)
{
// calculations
}