How can I traverse a multidimensional array using an array of keys?
<p>Let's say I have an arbitrary array of keys:</p>

<pre><code>$keys = array('foo', 'bar', 'baaz');
</code></pre>

<p>I'd like to use that array of keys to traverse a multidimensional array <code>$values</code> such that each element in the <code>$keys</code> array is one level of the <code>$values</code> array. For example, given the <code>$keys</code> array above, I'm looking for the equivalent of:</p>

<pre><code>$values['foo']['bar']['baaz']
</code></pre>

<p>or:</p>

<pre><code>$values[$keys[0]][$keys[1]][$keys[2]]
</code></pre>

<p>But I won't know what's in the <code>$keys</code> array or how large it is, so I couldn't hard code it like this. </p>

<p>Is there an elegant way to do this?</p>
