I'd like to use a variable as an array key of unknown depth.
Example:
$a = array();
$arrayKey = '[0][1]';
What I'd like to do is substitute:
$a[0][1] = "two levels deep";
with
${'a'.$arrayKey} = "two levels deep";
but it doesn't seem to work.
echo 'a'.$arrayKey;
returns: a[0][1]
echo ${'a'.$arrayKey}
returns two levels deep
but I still cannot do
${'a'.$arrayKey} = "two levels deep";
echo $a[0][1];
Is this even possible? It almost seems as though php is parsing a[0][1]
as a variable instead of a multidimensional array.