Loop / loop in php syntax used to execute the same over and over again automatically.
PHP Loops / Repetition.
Often times when you're memory want to run the same syntax repeatedly and loop in PHP is very useful for running the same syntax repeatedly.
There are several ways to run loop / loop in PHP
Repetition ........... while going on the run if the conditions of the statements in the state right / true.
do ..... while .. Program will walk up to see the false statements.
for use for basic .............. Repetition is determined by the number or boundaries determined from the value of the variable delimiter.
foreach Repetition ....... for special array variable
Using repetition while.
<? php
$ i = 1;
while ($ i <= 5) {
echo 'No'. $ i. '<br />';
$ i + +;
}
?>
RESULTS:
No. 1
No. 2
No. 3
No. 4
No. 5
Do ... while
<? php
$ i = 1;
do {
$ i + +;
echo 'No'. $ i. '<br />';
}
while ($ i <= 5);
?>
RESULTS:
No. 1
No. 2
No. 3
No. 4
No. 5
No comments:
Post a Comment