Multi Level Array Problem

Posted on 16th Feb 2014 by admin

hi all,

For example I have array like below:

$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.

Other forums