In PHP, I have an associative array like this
$a = array('who' => 'one', 'are' => 'two', 'you' => 'three');
How to write a foreach
loop that goes through the array and access the array key and value so that I can manipulate them (in other words, I would be able to get who
and one
assigned to two variables $key
and $value
?
foreach ($array as $key => $value) {
echo "Key: $key; Value: $value\n";
}