how to traverse associative array in php code example
Example: php foreach associative array
$arr = array(
'key1' => 'val1',
'key2' => 'val2',
'key3' => 'val3'
);
foreach ($arr as $key => $val) {
echo "$key => $val" . PHP_EOL;
}
$arr = array(
'key1' => 'val1',
'key2' => 'val2',
'key3' => 'val3'
);
foreach ($arr as $key => $val) {
echo "$key => $val" . PHP_EOL;
}