title: Tree map by categories
body: <p>I'm trying to build a tree-map from categories.</p>
  
  <p>I have the categories (I have a lot of categories and I want to remove duplicates and show them in a tree-map view)</p>
  
  <pre><code>$cat = array(
      "Sneakers/Men",
      "Sneakers/Women",
      "Accessories/Jewellery/Men",
      "Accessories/Jewellery/Women",
      "Accessories/Jewellery/Men
  ");
  </code></pre>
  
  <p>...and I want them like this</p>
  
  <pre><code>$categories = array(
      "Sneakers" =&gt; array(
          "Men" =&gt; array(),
          "Women" =&gt; array()
      ),
      "Accessories" =&gt; array(
          "Jewellery" =&gt; array(
              "Men" =&gt; array(),
              "Women" =&gt; array()
          )
      )
  );
  </code></pre>
  
  <p>to print them like this</p>
  
  <pre><code>- Sneakers
  -- Men
  -- Women
  
  - Accessories
  -- Jewellery
  --- Men
  --- Women
  </code></pre>