Multi Level Array Problem


Posted on 16th Feb 2014 07:03 pm by admin

hi all,

For example I have array like below:

Did you know?Explore Trending and Topic pages for more stories like this.
$temp = array(array('north america', 'us', 'california'), array('north america', 'us', 'hawaii'), array('north america', 'canada', 'vancouver'), array('asia', 'singapore', 'orchard');

I need to filter it out. So i hope the result could be:

array
'north america' =>
array
'us' =>
array 0 =>string 'california'
1 =>string 'hawai'
'asia' =>
array
'singapore'
array 0 => string 'orchard'



Anyone could help me to sorf out the logic? I just cannot solve this question.

Thanks
No comments posted yet

Your Answer:

Login to answer
109 Like 7 Dislike
Previous forums Next forums
Other forums

Show message after entering data
Hello Colleagues

I would like to display messages after entering the data example: "
dat

Question about ShowWindow()
Hello....

I'm struggling with sumpin, and I hope y'all can help.

I've got a CFormView

issues verifying if user is logged in
I am having issues when a user logs in via asp Login control, the IsAuthenticated still seems to com

gmdate() - want 1 hr before time
Hi,
I am using php gmdate().
Now I am entering all dates in my dbase using gmdate("Y-m-d

When file included, REMOTE_ADDR is server's?
I have an index file that handles my site, basically index.php?page=ip will activate "require('

PHP Code To Change Font Color in Table Cell
I would appreciate help with the following snippet of my php code. I am just trying to change the f

Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!<

Batch Session SM35 stuck in status 'in Background
Hi Experts,

I am facing a problem with Batch Input session SM35.

The batch se

Please help - should be a simple fix.. driving me nuts
Everything seemed to be working fine. I have a table, it alphabetically lists a bunch of cities and

Placing and array within an array then sorting it!
I have a page that runs two large mysql queries and saves the results into arrays, in php I then per

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash