title: php mkdir folder tree from array
body: <p>I'm trying to create a folder tree from an array, taken from a string.</p>
  
  <pre><code>$folders = str_split(564);
  </code></pre>
  
  <p>564 can actually be any number. The goal is to create a folder structure like /5/6/4</p>
  
  <p>I've managed to create all folders in a single location, using code inspired from another thread - </p>
  
  <pre><code>for ($i=0;$i&lt;count($folders);$i++) {
      for ($j=0;$j&lt;count($folders[$i]);$j++) {
          $path .= $folders[$i][$j] . "/";
          mkdir("$path");
      }
      unset($path);
  }
  </code></pre>
  
  <p>but this way I get all folders in the same containing path.
  Furthermore, how can I create these folders in a specific location on disk? Not that familiar with advanced php, sorry :(</p>
  
  <p>Thank you.</p>