learn php for loop | All In One Tuts

For Loop In PHP

The for loop is used to repeat a block of statements enclosed in curly braces. An increment counter is used to increment and terminate the loop. The for loop is useful for any repetitive operation, and is often used in combination with arrays to operate on collections of data/pins.

There are three parts of  for loop header:

for (initialization; condition; increment) {
//statement(s);
}

Below is a brief diagram of PHP For Loop

PHP For Loop | All In One Tuts

The initialization happens first and exactly once. Each time through the loop, the condition is tested if it’s true, the statement block, and the increment is executed, then the condition is tested again. When the condition becomes false, the loop ends.

Hope you like this article. If yes kindly give us a small feedback so that we can improve our quality content.

Hello Viewers,
welcome to the Allinonetuts a Technical tutorial and Programming Blog Maintained by Vikas Kardam, a Web Developer and Blogger From Delhi, India.
For Loop In PHP was last modified: April 20th, 2017 by Vikas Kardam

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *