lynxus Posted December 7, 2009 Share Posted December 7, 2009 Hi guys, I have a array with country codes and then how many hits form that country. How do i echo eahc bit in while loop? Ive tried: foreach ($IpCount as $a) { echo "$a"; echo "<br>"; } However this for instance will just echo teh value, but not the key. Im really rubbish with arrays and no amount of googling is helping ( Mainly because im not sure on the question ) Link to comment https://forums.phpfreaks.com/topic/184278-echo-values-of-array-within-a-while-loop/ Share on other sites More sharing options...
JustLikeIcarus Posted December 7, 2009 Share Posted December 7, 2009 if you want the key its foreach($array as $key => $value){ echo $key . ' ' . $value . '<br />'; } Link to comment https://forums.phpfreaks.com/topic/184278-echo-values-of-array-within-a-while-loop/#findComment-972848 Share on other sites More sharing options...
lynxus Posted December 7, 2009 Author Share Posted December 7, 2009 Thanks. Could you help explain whats going on here. Whats th e => actually doing? This is breaking my brain and for some reason i cant get my head round it. something just isnt clicking and its driving me insane Link to comment https://forums.phpfreaks.com/topic/184278-echo-values-of-array-within-a-while-loop/#findComment-972849 Share on other sites More sharing options...
PFMaBiSmAd Posted December 7, 2009 Share Posted December 7, 2009 http://us.php.net/manual/en/control-structures.foreach.php Link to comment https://forums.phpfreaks.com/topic/184278-echo-values-of-array-within-a-while-loop/#findComment-972851 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.