PHP - Ways to Loop Through Array - PHP Source Code
PHP Several Ways to Loop Through and Array Including FOREACH, DO LOOP & FOR I
Home
Short:
Here are 4 ways to loop in php
PHP FOREACH Loop
foreach ($array as $value) { // echo $value; }
PHP For I Loop
for ($i = 0; $i <= count($array); $i++) { // echo $array[$i]; }
PHP DO WHILE Loop
do { // echo $array[$i] . '
'; $i++; } while ($i < count($array);
PHP WHILE Loop
while($i < count($array)) { // echo $array[$i] . '
'; $i++; }
source code home