Can anyone give me an example of associative array using loop.... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone give me an example of associative array using loop....

example

16th Feb 2018, 4:51 AM
phenom**
phenom** - avatar
3 Answers
+ 3
Sure, is this the type of thing your after? $array = array('Tom' => '27', 'Bob' => '21'); $names = array_keys($array); for($i=0; $i < count($names); ++$i) { echo $names[$i] . ' ' . $array[$names[$i]] . "<br>"; }
16th Feb 2018, 9:20 AM
ihateonions
+ 3
phenom** ... CONGRATULATIONS FOR ANSWERER BADGE😇🌟🌟
24th May 2018, 6:29 PM
❤😎SYK 😎❤
❤😎SYK 😎❤ - avatar
+ 2
thanks.....ihateonions
16th Feb 2018, 9:27 AM
phenom**
phenom** - avatar