If I have an array that contains ['key1', 'key2', 'key3']
is there any way to map this to an array $array['key1']['key2']['key3']
without using loops or eval()?
Example of an array:
$var = [
'key1' => [
'subkey1' => [
'finalkey' => 'value',
],
'subkey' => [
'otherkey' => 'value',
],
],
'key2' => 'blah'
];
And then I have an array like this:
$keys = ['key1', 'subkey1', 'finalkey']
or
$keys = ['key1', 'subkey']