+ 2
An example of foreach loop with key
Please code a foreach loop with key.
3 Answers
+ 2
Hi Calvin. Thanks for the help. I slightly modified your code. check.
https://code.sololearn.com/wi62lBGK8s8K/?ref=app
+ 2
foreach loop with key and if condition
https://code.sololearn.com/wkTRQKAfI2N0/?ref=app
0
$countryCode = array(
"USA" => 1,
"UK" => 44,
"Australia" => 61,
"NZ" => 66
);
foreach ($countryCode as $country => $code) {
echo "\$countryCode[$country] => $code.\n";
}