$b = 0;
foreach ($settings['items'] as $item){
$b++;
if ($b==1){
$out .='First';
} else{
$out2 .='Second';
}
}
echo '<div class="inner">'.$out.'</div>';
echo '<div class="inner">'.$out2.'</div>';
which output
<div class="inner">First</div>
<div class="inner">Second Second Second Second</div>
But I would like to have this structure
<div class="inner">First</div>
<div class="inner">Second Second</div>
<div class="inner">Second Second</div>
One probable solution that I thought is using array_slice But for first loop I only need one element not two, that's why I think I can not do that.
$out2come from?$b % 3 == 0means first column,$b % 3 != 0means second or third. (Requires starting your counter at 0 for the first item.)