What is the syntax of the foreach loop in case of associative array ? A foreach($array as $key => $value) B foreach($array as $key : $value) C foreach($array as $key :: $value) D foreach($array as $key :> $value) code example
Example 1: php loop through array
$clothes = array("hat","shoe","shirt");
foreach ($clothes as $item) {
echo $item;
}
Example 2: loop through values of hash php
foreach ($array as $key => $val) {
print "$key = $val\n";
}