Changes

Jump to: navigation, search

PHP Flow Control and Looping

16 bytes added, 17:36, 31 May 2007
PHP ''for'' loops
</pre>
Whilst this is somewhat ungainly and time consuming to type , it does work. What would happen, however, if there was a requirement to perform this task 100 times or even 10,000 times. Writing a script to perform this as above would be prohibitively time consuming. This is exactly the situation the ''for'' loop is intended to handle.
The syntax of a PHP ''for loop'' is as follows:
for ( ''initializer''; ''conditional expression''; ''loop expression'' )
{
// PHP statements to be executedgo here
}
</pre>

Navigation menu