How to search multidimensional array with array of keys
<p>Imagine that you have the following data structures. The config one is a hash of config values. The search is an array of hash keys to pull a config value from the config hash.</p>

<pre><code>$config['users']['students']['default']['school'] = 'Garfield High';
$config['users']['students']['default']['domain'] = 'ghs.com';
$config['users']['teacher']['default']['fruit'] = 'apple';
$config['school']['superintendent'] = 'Boris York';

$search[] = 'users';
$search[] = 'students';
$search[] = 'default';
$search[] = 'school';
</code></pre>

<p>What's the most efficient way to use the $search array to get the value "Garfield High."</p>

<p>This sounds like a school assignment, but really it isn't. I've wandered down a rabbit hole, and while I'll probably abandon this thing that I'm doing, I'm curious how best to solve this problem. It seems like it should be easy, but for some reason, I'm stumped.</p>

<p>The method to extract values from $config should work with any $search array size. It needs to work with $search = array('school', 'superintendent') as well.</p>

<pre><code>public function get($search, $config) {
    // Somehow pull value from $config

}
</code></pre>