Pythondesigns Posted September 26, 2006 Share Posted September 26, 2006 Hey,I have an array like this which is called $CFG.[quote]Array( [online] => 1 [sitename] => MySite [indexurl] => http://mysite.com [areas] => Array ( [home] => Array ( [id] => 1 [text] => Home [order] => 0 [navshow] => 1 ) [profile] => Array ( [id] => 2 [text] => Profile [order] => 1 [navshow] => 1 ) [jobs] => Array ( [id] => 3 [text] => Jobs [order] => 3 [navshow] => 1 ) [business] => Array ( [id] => 4 [text] => Business [order] => 4 [navshow] => 1 ) [finance] => Array ( [id] => 5 [text] => Finance [order] => 5 [navshow] => 1 ) ))[/quote]As you can see the $CFG[areas] is another array. And then within each again is an array.Basically each of the values inside the $CFG[areas] are links for a menu Im making and what I want to do is to cycle through them all (theres 5 of them) and display its relevant id.So at the end I want this...[quote]Home (which links to homes id)Profile (which links to profiles id)Jobs (which links to jobs id)And so on...[/quote]How can I do this?Thanks Link to comment https://forums.phpfreaks.com/topic/22163-help-with-array-solved/ Share on other sites More sharing options...
Barand Posted September 26, 2006 Share Posted September 26, 2006 [code]foreach ($CFG['areas] as $key => $data) { echo "$key : {$data['id']} <br/>";}[/code] Link to comment https://forums.phpfreaks.com/topic/22163-help-with-array-solved/#findComment-99248 Share on other sites More sharing options...
Pythondesigns Posted September 26, 2006 Author Share Posted September 26, 2006 Thanks.It worked perfect :D Link to comment https://forums.phpfreaks.com/topic/22163-help-with-array-solved/#findComment-99264 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.