How to use break in if (Command) : <p>I am using <strong><em>$i</em></strong> string for limit in foreach loop.</p>

<pre><code>$i = 0;
foreach($string as $menu){
   $i++;
   if($i == 6){
   break;
   }
   $menu_name = $menu['name'];
   $menu_style = $menu['style'];

   // i want to show total 5 menu names.


   if($menu_style == 'magazine'){
   // i have 5+ menus names (magazine style)
   // butt here i want to show just one last magazine 
   echo $menu_name;
   }

   if($menu_style == 'normal'){
   // i have 5+ names menus (normal style)
   // butt here i want to show  4 last normal style 
   echo $menu_name.'&lt;br&gt;';
   }

}
</code></pre>

<p>I can't want to use LIMIT in SQL query.</p>

<blockquote>
  <p>And tell me when i use <em>if($i == 5){ break; }</em> then code display just 4
  menu name</p>
</blockquote>

<p>Tell me how is display menu name as my required.</p>
