Execute a block of code a specified number of times, or while a specified condition is true. -----------------------------------------------------------------------------------------------------------------------------------------
For Loop
The following example defines a loop that starts with x=1. The loop will continue to run as long as x is less than, or equal to 3. x will increase by 1 each time the loop runs:
############################################################
The Output:
The number is 1
The number is 2
The number is 3
############################################################
foreach Loop
The following example shows for every loop iteration, the value of the current array element is assigned to $value (and the array pointer is moved by 1) - so on the next loop iteration, you'll be looking at the next array value:
############################################################
The Output:
Sunday
Monday
Tuesday
############################################################
.jpg)


0 comments:
Post a Comment