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 Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Pythondesigns Posted September 26, 2006 Author Share Posted September 26, 2006 Thanks.It worked perfect :D 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.