title: navigator recursive make heirarchy array
body: <p><a href="https://i.stack.imgur.com/b6Wno.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b6Wno.png" alt="this is table "></a>
  <br />
  <br />
  i want the parent with childs in array!
  recursive part is make a empty array!
  php:</p>
  
  <pre><code>function buildNavigation($items, $parent = NULL) {
      $arr = [];
      foreach ($items as $item) {
          if ($item-&gt;parent == $parent) {
              $hasChildren = true;
              $arr[] = $item-&gt;title;
              $arr[] = $item-&gt;link;
  
              $arr[] = $this-&gt;buildNavigation($items, $item-&gt;id);
          }
      }
      return $arr;
  }
  </code></pre>
  
  <p>result: </p>
  
  <pre><code>array (size=15)
  0 =&gt; string 'صفحه اصلی' (length=17)
  1 =&gt; string 'index' (length=5)
  2 =&gt; 
  array (size=0)
    empty
  3 =&gt; string 'محصولات' (length=14)
  4 =&gt; string 'products' (length=8)
  5 =&gt; 
  array (size=69)
    0 =&gt; string 'ابزار' (length=10)
    1 =&gt; string 'cornic' (length=6)
    2 =&gt; 
      array (size=0)
        empty
  
  12 =&gt; string 'تمام صفحات' (length=19)
  13 =&gt; string '' (length=0)
  14 =&gt; 
  array (size=0)
    empty
  </code></pre>
  
  <blockquote>
    <p>array (size=0)
          empty</p>
  </blockquote>
  
  <p>how can remove this empty array from all?<br />
  thanks for help! 
  how should remove that?</p>