title: Nested foreach in codeigniter
body: <p>I have view like this</p>
  
  <pre><code>&lt;?php foreach ($category as $c) { ?&gt;
  &lt;li&gt;&lt;?php echo $c['name_category'];?&gt;&lt;/li&gt;
  
  &lt;?php foreach ($sub_category as $sc) {
  if($sc['id_category']==$c['id_category']) { ?&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;?php echo $sc['subname_category'];?&gt;&lt;/li&gt;
    &lt;/ul&gt; 
  &lt;?php } } }?&gt;
  </code></pre>
  
  <p>results from the view is</p>
  
  <p><a href="https://i.stack.imgur.com/KzPOF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KzPOF.png" alt="enter image description here"></a></p>
  
  <p>but I want a look like this </p>
  
  <p><a href="https://i.stack.imgur.com/zVvEs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zVvEs.png" alt="enter image description here"></a></p>