title: Nested array to HTML list
body: <p>I have the following array : </p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [ID] =&gt; 1
              [PARENT] =&gt; 0
              [NAME] =&gt; Your first category
          )
      [1] =&gt; Array
          (
              [ID] =&gt; 2
              [PARENT] =&gt; 1
              [NAME] =&gt; Your first forum
          )
      [2] =&gt; Array
          (
              [ID] =&gt; 4
              [PARENT] =&gt; 1
              [NAME] =&gt; Another Forum
          )
      [3] =&gt; Array
          (
              [ID] =&gt; 5
              [PARENT] =&gt; 1
              [NAME] =&gt; Good Forum
          )
      [4] =&gt; Array
          (
              [ID] =&gt; 6
              [PARENT] =&gt; 0
              [NAME] =&gt; Top Forum
          )
      [5] =&gt; Array
          (
              [ID] =&gt; 7
              [PARENT] =&gt; 6
              [NAME] =&gt; Sub Forum #1
          )
      [6] =&gt; Array
          (
              [ID] =&gt; 9
              [PARENT] =&gt; 7
              [NAME] =&gt; Sub Forum #1-1
          )
      [7] =&gt; Array
          (
              [ID] =&gt; 10
              [PARENT] =&gt; 7
              [NAME] =&gt; Sub Forum #1-2
          )
      [8] =&gt; Array
          (
              [ID] =&gt; 8
              [PARENT] =&gt; 6
              [NAME] =&gt; Sub Forum #2
          )
  )
  </code></pre>
  
  <p>OK Here I have the var_export result as requested : </p>
  
  <pre><code>array (
    0 =&gt; 
    array (
      'ID' =&gt; '1',
      'PARENT' =&gt; '0',
      'NAME' =&gt; 'Your first category',
    ),
    1 =&gt; 
    array (
      'ID' =&gt; '2',
      'PARENT' =&gt; '1',
      'NAME' =&gt; 'Your first forum',
    ),
    2 =&gt; 
    array (
      'ID' =&gt; '4',
      'PARENT' =&gt; '1',
      'NAME' =&gt; 'Another Forum',
    ),
    3 =&gt; 
    array (
      'ID' =&gt; '5',
      'PARENT' =&gt; '1',
      'NAME' =&gt; 'Good Forum',
    ),
    4 =&gt; 
    array (
      'ID' =&gt; '6',
      'PARENT' =&gt; '0',
      'NAME' =&gt; 'Top Forum',
    ),
    5 =&gt; 
    array (
      'ID' =&gt; '7',
      'PARENT' =&gt; '6',
      'NAME' =&gt; 'Sub Forum #1',
    ),
    6 =&gt; 
    array (
      'ID' =&gt; '9',
      'PARENT' =&gt; '7',
      'NAME' =&gt; 'Sub Forum #1-1',
    ),
    7 =&gt; 
    array (
      'ID' =&gt; '10',
      'PARENT' =&gt; '7',
      'NAME' =&gt; 'Sub Forum #1-2',
    ),
    8 =&gt; 
    array (
      'ID' =&gt; '8',
      'PARENT' =&gt; '6',
      'NAME' =&gt; 'Sub Forum #2',
    ),
  )
  </code></pre>
  
  <p>Some of that arrays PARENT value corespond to another array ID value. That helps me to make them nested. But the question is: how can I create an HTML list that will look like that:</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li id="1"&gt;
          Your First Category
          &lt;ul&gt;
              &lt;li id="2"&gt;
                  Your First Forum
              &lt;/li&gt;
              &lt;li id="4"&gt;
                  Another Forum
              &lt;/li&gt;
              &lt;li id="5"&gt;
                  Good Forum
              &lt;/li&gt;
          &lt;ul&gt;
      &lt;/li&gt;
      &lt;li id="6"&gt;
          Top Forum
          &lt;ul&gt;
              &lt;li id="7"&gt;
                  Sub Forum #1
                  &lt;ul&gt;
                      &lt;li id="9"&gt;
                          Sub Forum #1-1
                      &lt;/li&gt;
                      &lt;li id="10"&gt;
                          Sub Forum #1-2
                      &lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/li&gt;
              &lt;li id="7"&gt;
                  Sub Forum #2
              &lt;/li&gt;
          &lt;ul&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Any idea please?</p>