OkFx.Net, get rebates from your trade

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 :
  • The foreach Statement
  • PHP If…Else Statements
  • The do…while Statement
  • while Statement
  • How to Use the PHP Include Statement
  • 2 Responses to “The for Statement”

    1. Irving Daniel Says:

      lomr7l7tk1g0l9jm


      reply
    2. Juli Mcleod Says:

      lomr7l7tk1g0l9jm


      reply

    Leave a Reply