For loops
This for loop will assign $i
with three and increment it by 1.
for($i = 3, $i < 10, 1) //Do something end for
This for loop will assign $i
to $j
and increment $i
by 2.
$j = 4 for($i = $j, $i < 10, 2) //Do something end for
This for loop will not instantiate $i
but will inform the loop that $i
is the value to increment.
$i = 3 for($i, $i < 10, 1) //Do something end for
As of version 1.4.2, for loops can be written in the exact syntax of a C-style for loop in that the $i++
can be used in place
of the increment or decrement value. Placing a pre-decrement or pre-increment expression such as --$i
will result in
the value being changed before the for loop iterates.
for($i = 3; $i < 10; $i++) //Do something end for
As with all loops, for loops may be terminated by
end loop
.
for($i = 3, $i < 10, 1) //Do something end loop