Setting multi-dimensional arrays with a dynamic subscript
<p>I want to find a way to set a value in a multi-dimensional array with a dynamic subscript. Let me illustrate a very simple example:</p>

<pre><code>$deep['foo'] = array();
$deep['foo']['bar'] = "Elvis has left the building";
$meta = array( 'foo','bar' );
$super_meta = "[{$meta[0]}][{$meta[1]}]";
echo "\nWhere is Elvis? " . $deep[$meta[0]][$meta[1]] . ". Are we sure?\n";
echo "\nWhere is Elvis? " . $deep{$super_meta} . ".\n\n";
</code></pre>

<p>In this example the first echo line prints <code>Elvis has left the building</code> as we'd expect but in the second echo line, we don't know until runtime how many levels deep in the <code>$meta</code> structure we are going to go. In a desperate attempt to make my dreams come true I've added the <code>$deep{$super_meta}</code> command. No errors but it results in an empty string. Darn. </p>

<p>With my dreams crushed I'm hoping someone can pick me back up again and show me the proverbial "PHP light". </p>
