+ 2

An example of foreach loop with key

Please code a foreach loop with key.

16th May 2017, 4:50 AM
Geetha Kadhirvelu
Geetha Kadhirvelu - avatar
3 ответов
+ 2
Hi Calvin. Thanks for the help. I slightly modified your code. check. https://code.sololearn.com/wi62lBGK8s8K/?ref=app
16th May 2017, 5:14 AM
Geetha Kadhirvelu
Geetha Kadhirvelu - avatar
+ 2
foreach loop with key and if condition https://code.sololearn.com/wkTRQKAfI2N0/?ref=app
16th May 2017, 5:21 AM
Geetha Kadhirvelu
Geetha Kadhirvelu - avatar
0
$countryCode = array( "USA" => 1, "UK" => 44, "Australia" => 61, "NZ" => 66 ); foreach ($countryCode as $country => $code) { echo "\$countryCode[$country] => $code.\n"; }
16th May 2017, 4:57 AM
Calviղ
Calviղ - avatar