title: PHP array of tree with arrays
body: <p>I have problem with make automatic tree of arrays in PHP. Ex. i have numbers in my array: 2, 3, 3, and i can manulally make tree.</p>
  
  <pre><code>&lt;?
  $source_arr = array(2,3,3);
  
  for($x=0; $x&lt;$source_arr[0]; $x++){ // level 0: 2 loops
  
  for ($xx=0; $xx&lt;$source_arr[1]; $xx++) {  // level 1: 3 loops
  
      for ($xxx=0; $xxx&lt;$source_arr[2]; $xxx++) {  // level 2: 3 loops
  
          $new[] = "$x$xx$xxx";
  
     }    
      }
  }   
  
  echo "&lt;pre&gt;";
  print_r($new);
  echo "&lt;/pre&gt;";
  
  ?&gt;
  </code></pre>
  
  <p>result:</p>
  
  <pre>
  Array
  (
      [0] => 000
      [1] => 001
      [2] => 002
      [3] => 010
      [4] => 011
      [5] => 012
      [6] => 020
      [7] => 021
      [8] => 022
      [9] => 100
      [10] => 101
      [11] => 102
      [12] => 110
      [13] => 111
      [14] => 112
      [15] => 120
      [16] => 121
      [17] => 122
  )
  </pre> 
  
  <p>But i want to automate it, i have different numbers of levels arrays with different values, like this: 11 levels:</p>
  
  <pre><code>$source_arr = array(8,5,10,12,5,8,12,5,6,10,8);
  </code></pre>
  
  <p>And i want to  build automatic large tree. Is it possible with PHP array_walk or array_walk_recursive ? I found posts about building recursive categories tree, but i can not adapt those codes.</p>
  
  <p>edit: i do not want to do infinity array and achieve memory exhaustion. My array count is never larger than 15 items, values range: 3-16. </p>