title: multidimensional array
body: <p>What is the meaning of the following line:<br/>
  <code>$data[0][$row-&gt;parentid]['children'][$row-&gt;id] = $row-&gt;name</code> </p>
  
  <p>From the function:</p>
  
  <pre><code>function getCategoriesNav(){
      $data = array();
  
      $this-&gt;db-&gt;select('id,name,parentid');
      $this-&gt;db-&gt;where('status', 'active');
      $this-&gt;db-&gt;orderby('parentid','asc');
      $this-&gt;db-&gt;orderby('name','asc');
      $this-&gt;db-&gt;groupby('parentid,id');
      $Q = $this-&gt;db-&gt;get('categories');
      if ($Q-&gt;num_rows() &gt; 0){
          foreach ($Q-&gt;result() as $row){
              if ($row-&gt;parentid &gt; 0){
                  $data[0][$row-&gt;parentid]['children'][$row-&gt;id] = $row-&gt;name;
              }
              else{
                  $data[0][$row-&gt;id]['name'] = $row-&gt;name;
              }
          }
      }
      $Q-&gt;free_result(); 
      return $data; 
  }
  </code></pre>
  
  <p>Where do the children come from, and what is the meaning of:<br/>
  <code>$row-&gt;parentid or $row-&gt;name</code>?  <br/>I don't have any field 'children' in my table, and it's not declared any where.  Please help</p>
  
  <p>Thank you in advance,
  Mehdy</p>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>Sorry if I didn’t explain the question clearly. My question was: what is the meaning of the following line in this function 
  <code>$data[0][$row-&gt;parentid]['children'][$row-&gt;id] = $row-&gt;name</code>, from where this children come from, and what actual mean by <code>$row-&gt;parentid</code> or <code>$row-&gt;name</code>? I don’t have any field 'children' in my table, and it’s not declared anywhere, please help me. </p>
  
  <p>Thank you 
  mehdy  </p>