title: PHP explode string key into multidimensional array with values
body: <p>I have an array:</p>
  
  <pre><code>$array = [
      "main;header;up" =&gt; "main_header_up value",
      "main;header;bottom" =&gt; "main_header_bottom value",
      "main;bottom" =&gt; "main_bottom value",
      "main;footer;right;top" =&gt; "main_footer_right_top value"
  ];
  </code></pre>
  
  <p>What I'd like to get is explode the array keys into multidimensional array but keep the values and the result should be equivalent of this array:</p>
  
  <pre><code>$array = [
      "main" =&gt; [
          "header" =&gt; [
              "up" =&gt; "main_header_up value", 
              "bottom" =&gt; "main_header_bottom value"
          ],
          "bottom" =&gt; ["main_bottom value"],
          "footer" =&gt; [
              "right" =&gt; [
                  "top" =&gt; "main_footer_right_top value
              ]
          ]
      ]
  ];
  </code></pre>
  
  <p>I guess I should state that the number of <code>;</code> is not predetermined. There could be none or there could be 10 (or more) of them in a key / index.</p>
  
  <p>Is there any elegant way to achieve this?</p>