Suppose I have below a nested / multidimensional array:
array( 'World'=>array( 'Asia'=>array( 'Japan'=>array( 'City'=>'Tokyo' ) ) ) );
I want to find out all the parents in the heriarchy of the current city.
For example, for a city, the answer should be an array of parents containing:
array( 'World'=>array( 'Asia'=>array( 'Japan' ) ) );
So, how do I find all parents in a chain in a nested array?
source share