title: Wrapping each child key within an UL
body: <p>I'm wanting to wrap each child array within an <code>&lt;ul&gt;</code>, but I'm not entirely sure how it may be done? </p>
  
  <pre><code>function RecursiveWrite($array) {
      foreach ($array as $v) {
  
          echo '&lt;li&gt;';
  
              echo $v['id'];
  
              if(isset($v['children']))
                  RecursiveWrite($v['children']);
  
          echo '&lt;/li&gt;';
  
      }
  }
  
  echo '&lt;ul&gt;';
  RecursiveWrite($comments);
  echo '&lt;/ul&gt;';
  </code></pre>
  
  <p>Outputs:</p>
  
  <pre><code>    &lt;ul&gt;
          &lt;li&gt;81
              &lt;li&gt;173&lt;/li&gt;
              &lt;li&gt;84
                  &lt;li&gt;85
                      &lt;li&gt;131
                          &lt;li&gt;176&lt;/li&gt;
                      &lt;/li&gt;
                  &lt;/li&gt;
                  &lt;li&gt;174&lt;/li&gt;
                  &lt;li&gt;175&lt;/li&gt;
              &lt;/li&gt;
          &lt;/li&gt;
          &lt;li&gt;178&lt;/li&gt;
      &lt;/ul&gt;
  </code></pre>
  
  <p>The output I'm wanting to get:</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li&gt;81
          &lt;ul&gt;
              &lt;li&gt;173&lt;/li&gt;
              &lt;li&gt;84
                  &lt;ul&gt;
                      &lt;li&gt;85
                          &lt;ul&gt;
                              &lt;li&gt;131
                                  &lt;ul&gt;
                                      &lt;li&gt;176&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/li&gt;
                      &lt;li&gt;174&lt;/li&gt;
                      &lt;li&gt;175&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;178&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Original array:</p>
  
  <pre><code>array (
    0 =&gt; 
    array (
      'id' =&gt; '81',
      'parent' =&gt; NULL,
      'children' =&gt; 
      array (
        0 =&gt; 
        array (
          'id' =&gt; '173',
          'parent' =&gt; '81',
        ),
        1 =&gt; 
        array (
          'id' =&gt; '84',
          'parent' =&gt; '81',
          'children' =&gt; 
          array (
            0 =&gt; 
            array (
              'id' =&gt; '85',
              'parent' =&gt; '84',
              'children' =&gt; 
              array (
                0 =&gt; 
                array (
                  'id' =&gt; '131',
                  'parent' =&gt; '85',
                  'children' =&gt; 
                  array (
                    0 =&gt; 
                    array (
                      'id' =&gt; '176',
                      'parent' =&gt; '131',
                    ),
                  ),
                ),
              ),
            ),
            1 =&gt; 
            array (
              'id' =&gt; '174',
              'parent' =&gt; '84',
            ),
            2 =&gt; 
            array (
              'id' =&gt; '175',
              'parent' =&gt; '84',
            ),
          ),
        ),
      ),
    ),
    1 =&gt; 
    array (
      'id' =&gt; '178',
      'parent' =&gt; NULL,
    ),
  )
  </code></pre>