Don't quite understand the question.
However, the for loop works like this:
for (initialize; condition; action) { .. }
initialize is evaluated (executed) only once; at the beginning of the loop. The usual thing to do here, is to assign a value to a variable.
If condition returns false, the loop ends. The normal thing to do here is a comparison with a criteria that is modified in action.
Action usually increments (or decrements) a variable. The action should a some point make the condition false.
for ($x = 0; $x < 10; $x++) {
print $x;
}
- initialize: set $x to 0 (Only run once)
- condition: is $x < 10? Yes, it's 0, run
(print $x, or whatever is in the brackets)
- action: increment $x by 1
(next)
- condition: is $x < 10? Yes, it's 1, run
print $x or whatever
- action: increment $x by 1
.... 8 more ....
- condition: is $x < 10? No, it's 10. Break loop.
(Note that < is different from <= (latter meaning less or equal))
Note that the initial error, one '=' instead of two, caused condition to be false at first run. = is an assignment operator, and == is a comparison operator. You assigned a value instead of comparing it, and there is no return value for an assignment (wich qualifies as 'false').
Hope that cleared up something 🙂