title: Break String in to multilevel object (or array)
body: <p>I have a string like this: -</p>
  
  <pre><code>dev/clients/518/aaa/1915/bbb/1/file.pdf
  </code></pre>
  
  <p>and my aim is to be able to refer to <code>file.pdf</code> via a multilevel object</p>
  
  <pre><code>dev-&gt;clients-&gt;518-&gt;aaa-&gt;1915-&gt;bbb-&gt;1
  </code></pre>
  
  <p>or an array</p>
  
  <pre><code>[dev][clients][518][aaa][1915][bbb][1]
  </code></pre>
  
  <p>This is a key from AWS S3 from which I am trying to create a navigable structure. I can explode the string to get</p>
  
  <pre><code>Array
  (
      [0] =&gt; dev
      [1] =&gt; clients
      [2] =&gt; 518
      [3] =&gt; aaa
      [4] =&gt; 1915
      [5] =&gt; bbb
      [6] =&gt; 1
      [7] =&gt;file.pdf
  )
  </code></pre>
  
  <p>Not sure how to move forward from here. This might show what I'm after a little better: -</p>
  
  <pre><code>Array (
      [dev] =&gt; Array (
          [clients]  =&gt; Array (
              [518] =&gt; Array (
                  [aaa] =&gt; Array (
                      [1915] =&gt; Array (
                          [bbb] =&gt; Array (
                              [1] =&gt; file.pdf
                          )   
                      )
                  )   
              )
          )
      )
  )
  </code></pre>