Is there a way to reference an item within a multidimensional array by using a path or an array of path elements? EG.
$multi = array
(
'array_1' => array
(
'array_2' => array
(
'option_1' => 'value_1',
'option_2' => 'value_2',
)
)
);
$path = array('level_1', 'level_2', 'option_1');
$result = $multi[$path];
And have $result = 'value_1'?
The reason being, I have a recursive function for searching thru $multi and finding the key I need, and returning the $path. I know i can hard code in the path from my own code but i'm trying to make this reusable so that i can edit the $multi and the function will still work.
$result = $multi['array_1']['array_2']['option_1'];do the trick?