Answers for "how to iterate through php array"

PHP
67

php loop through array

$clothes = array("hat","shoe","shirt");
foreach ($clothes as $item) {
	echo $item;
}
Posted by: Guest on June-25-2019
4

how to iterate through php array

$ar = ['Rudi', 'Morie', 'Halo', 'Miki'];

for ($i=0, $len=count($ar); $i<$len; $i++) {
    echo "$ar[$i] \n";
}
/*
Rudi 
Morie 
Halo 
Miki 
*/
Posted by: Guest on January-16-2020
4

loop through php array

foreach (array_expression as $value)
    statement
foreach (array_expression as $key => $value)
    statement
Posted by: Guest on April-04-2020

Code answers related to "how to iterate through php array"

Browse Popular Code Answers by Language