[Solved] How to use break in if (Command) [closed]


Something like that?

$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 <= 5){
   // i have 5+ menus names (magazine style)
   // butt here i want to show just one last magazine 
       echo $menu_name;
   } else if($menu_style == 'normal' && $i <= 4){
   // i have 5+ names menus (normal style)
   // butt here i want to show  4 last normal style 
        echo $menu_name.'<br>';
   }

}

1

solved How to use break in if (Command) [closed]