using for each php code example
Example 1: php loop through array
$clothes = array("hat","shoe","shirt");
foreach ($clothes as $item) {
echo $item;
}
Example 2: foreach loop array php
foreach (array as $value){
//code to be executed;
print("value : $value");
}
foreach (array as $key => $value){
//code to be executed;
print("key[$key] => $value");
}