I have this array
$array = Array ( [a] => Array ( [0] => b [1] => h ) [b] => c [c] => d [h] => m )
And I need to convert the array as below
Array ( [a] => Array ( [b] => Array ( [c] => Array ( [d] => Array ( ) ) ) [h] => Array ( [m] => Array ( ) ) ) )
I already asked this question for a one-dimensional array.
I tried with [ Creating a nested parent child array from a one-dimensional array in php , and I got the following array
Array ( [a] => Array ( [b] => Array ( [a] => Array ( [h] => Array ( [b] => Array ( [c] => Array ( [d] => Array ( ) [h] => Array ( [m] => Array ( ) ) ) ) ) ) ) ) )
How to verify that a key is present in a multidimensional array, and if it is, add it to an existing key. Help solve the problem. Thanks at Advance
source share