title: Recursive category tree in php
body: <p>I have this sql table</p>
  
  <p><img src="https://i.stack.imgur.com/pqDP7.png" alt="I have this sql table"></p>
  
  <p>How to return it with php like?</p>
  
  <pre><code>Root1
  - SubCat 1
  -- SubSubCat 1
  - SubCat 2
  Root2
  </code></pre>
  
  <p>I found <a href="http://blog.ideashower.com/post/15147134343/create-a-parent-child-array-structure-in-one-pass" rel="nofollow noreferrer">this</a>, but i cant return it in form, that i need. But the script still displays all categories, first as a sub, and then as root.</p>
  
  <p>How to make it?</p>