how to loop key value pair in php code example
Example 1: loop through values of hash php
foreach ($array as $key => $val) {
print "$key = $val\n";
}
Example 2: foreach in php
<?php
// Declare an array
$arr = array("green", "blue", "pink", "white");
// Loop through the array elements
foreach ($arr as $element) {
echo "$element ";
}
?>