Help needed improving a foreach loop

makrem

New Member
I have this logic written that loops out an array into \[code\]<li>\[/code\]and gives #1 and every 5th a class of "alpha".\[code\]$count = 0; foreach($gallery->data as $row){ if ($count==0 || $count%4==0) { echo '<li class="alpha"></li>'.PHP_EOL; } else { echo '<li></li>'.PHP_EOL; } $count++; }\[/code\]I need to add to this and get the code adding a class of "omega" to every 4th \[code\]<li>\[/code\]
 
Back
Top