1
<documentation title="For Loops With Function Calls in the Test">
4
For loops should not call functions inside the test for the loop when they can be computed beforehand.
8
<code title="Valid: A for loop that determines its end condition before the loop starts.">
10
<em>$end = count($foo);</em>
11
for ($i = 0; $i < $end; $i++) {
16
<code title="Invalid: A for loop that unnecessarily computes the same value on every iteration.">
18
for ($i = 0; $i < <em>count($foo)</em>; $i++) {