I need to do this:
$array['level1']['level2']['level3'] = 'someval';
However, I don't know how many levels there are going to be. I want to be able to create these arrays with any number of levels automatically. I am trying to adapt the following so that it forms an actual PHP array:
for($i=1;$i<=3;$i++){
$string .= '_level'.$i;
};
${'array'.$string} = 'someval';
var_dump($array_level1_level2_level3); //Outputs: string(7) "someval"
Obviously that is no replacement for an array. I'm simply looking for a parallel that can be applied to multidimensional arrays. I suspect the answer lies in some kind of recursive function, but I'm not quite sure what.
Update
Here is what I really want to do. I've had trouble sufficiently explaining my problems and as a result the question was closed. So, I tried to take it apart into pieces.
https://stackoverflow.com/questions/8002490/creating-multidimensional-arrays-in-php