foreach through associative array php code example
Example 1: loop through values of hash php
foreach ($array as $key => $val) {
print "$key = $val\n";
}
Example 2: 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
*/