scm22ri Posted October 9, 2012 Share Posted October 9, 2012 Hi Everyone, I'm trying to get rid of the 0,1,2 etc ... in-front of my parameters when I display data from my array. Any help here would be appreciated. Thanks everyone! http://whatsmyowncar...week4/while.php (bottom example) $newschannels = array('Local'=>array('ABC6 News','CBS Stations','Local Fox News','NBC News'), 'Regional'=>array('YES Network','NESN'), 'National'=>array('Fox News','CNN','MSNBC'), 'International'=>array('BBC News','France International','Ireland International')); foreach($newschannels as $channels => $data){ echo "$channels".'<br>'; foreach($data as $key => $value){ echo "Region: $key, Channel: $value".'<br>'; } } Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 9, 2012 Share Posted October 9, 2012 Remove Region: $key from the echo? Seriously. Quote Link to comment Share on other sites More sharing options...
matthewtbaker Posted October 10, 2012 Share Posted October 10, 2012 (edited) Here you go; $newschannels = array('Local'=>array('ABC6 News','CBS Stations','Local Fox News','NBC News'), 'Regional'=>array('YES Network','NESN'), 'National'=>array('Fox News','CNN','MSNBC'), 'International'=>array('BBC News','France International','Ireland International')); foreach($newschannels as $channels => $data){ echo "$channels".'<br>'; foreach($data as $key => $value){ echo "Channel: $value".'<br>'; } } Simply delete the $key variable from your echo statement. Matt Edited October 10, 2012 by matthewtbaker Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.