Another way to learn New Technology

For Loop In PHP

0 40

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) {



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.