php Loop statements

Loops are used in programming to do the same tasks many times, while a condition is true...
That means, same script will be executed and repeated, until that condition becomes false.

The loop statements used in php are:
while
do ... while
for
foreach

while and do ... while are similar, the only difference is that, the first one will execute the script if and as long as the condition is true, but the second one, will execute the script, then repeat it as long as the condition is true. In brief, when condition is false while will not do the tasks and exit, but do ... while will do them and exit.

For is to repeat tasks a specific number of times, like you want to execute a script 10 times ....

Foreach to repeat tasks for each element in an array.

Next posts will show how to use these statements.

If you have any questions, post them.

2 comments:

Diablo 3 Gold said...

i enjoy your own composing ,their thus understandable ,pleasant and simple to read .. thx . Buy RS Gold Cheap Diablo III Gold

Interior Decorators Edison said...

Hi nicee reading your post