The for Statement
The for Statement
For statement is some Looping statements in PHP
The for statement is used when you know how many times you want to execute a statement or a list of statements.
for (initialization; condition; increment)
{
code to be executed;
}
Note: The for statement has three parameters. The first parameter initializes variables, the second parameter holds the condition, and the third parameter contains the increments required to implement the loop. If more than one variable is included in the initialization or the increment parameter, they should be separated by commas. The condition must evaluate to true or false.
Example
<html>
<body>
<?php
for ($i=1; $i<=5; $i++)
{
echo ” The number is $i<br />”;
}
?>
</body>
</html>
And output is
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
Related post :

November 13th, 2008 at 2:53 am
lomr7l7tk1g0l9jm
reply
November 13th, 2008 at 11:16 am
lomr7l7tk1g0l9jm
reply