>>949
散々既出だが・・・

http://php.net/manual/ja/function.count.php#46542

> When running loops with count conditions, the code runs faster
> if you first assign the count() value to a variable and use that
> (instead of using count() directly in a loop condition.

> As you can see, the second method (which doesnt use count() directly
> in the loop) is faster than the first method (which uses count() directly
> in the loop).

つーことで結論は出てるよ。

PHPのコンパイラがどの程度最適化してくれるのか知らんけど
後者の方が早いのは想像に難くない。