title: Convert single array to multidimensional array in php
body: <p>If a problem i try to solve now some hours, but simply cant find a solution. </p>
  
  <p>If a single array of paths </p>
  
  <pre><code>$singleArray = array(
     '/Web',
     '/Web/Test1',
     '/Web/Test2', 
     '/Web/Test2/Subfolder',
     '/Web/Test3',
     '/Public'
  );
  </code></pre>
  
  <p>From that array i want to create a mulitdimensional array, which keeps the keys but put subfolders in the correct parent folders. Later i want to loop over the new array to create a folder tree (but thats not a problem)</p>
  
  <p>The new array should look like this: </p>
  
  <pre><code>$multiArray = array(
     '/Web'=&gt;array(
        '/Web/Test1'=&gt;array(),
        '/Web/Test2'=&gt;array(
            '/Web/Test2/Subfolder'=&gt;array()
        ),
        '/Web/Test3'=&gt;array()
     ),
     '/Public'=&gt;array()
  );
  </code></pre>