Answers for "how to loop through an associative array in php"

PHP
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
1

php loop through array

$letters = ['a','b','c'];
foreach ($letters as $item) {
  echo $item;
}
Posted by: Guest on October-01-2020

Code answers related to "how to loop through an associative array in php"

Browse Popular Code Answers by Language