title: PHP build array from variables
body: <p>So I have a variable which I explode:</p>
  
  <pre><code>$values = explode ('|', $split);
  </code></pre>
  
  <p>This can contain any number of values from 1 to 10+</p>
  
  <p>I have another big array let's call it <code>$tree</code>. I need to loop round the <code>$values</code> whilst building up an array based on the <code>$tree</code> variable. </p>
  
  <p>E.g:</p>
  
  <pre><code>$newArray = $tree [$values [0]][$values [1]];
  </code></pre>
  
  <p>But this needs to be done dynamically based on the number of elements in the <code>$values</code> array. </p>
  
  <p>Any ideas?</p>
  
  <p>Thanks</p>