/* for loop */ for ($i = 1; $i <= 10; $i++) {echo $i; } /* while loop */ $i = 1;while ($i <= 10) { echo $i++; } /* do..while */ $i = 0;do { echo $i; } while ($i > 0); /* foreach */ $arr = array("1", "2", "3");foreach ($arr as $value) { echo "Value: $value\n"; } /* break */ break ends execution of the current for, foreach while, do..while or switch structure. break; /* continue */ continue is used within looping structures to skip the rest of the current loop iteration and continue execution at the beginning of the next iteration. continue; |
PHP : Looping
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment