Skip to content

Instantly share code, notes, and snippets.

@weotch
Created November 21, 2012 20:34
Show Gist options
  • Save weotch/4127482 to your computer and use it in GitHub Desktop.
Save weotch/4127482 to your computer and use it in GitHub Desktop.
Using modulo
<?
foreach($whatever as $i => $item) {
if ($i%3 === 0) //Open the ul
// Show the li like normal
if ($i%3 === 2 || count($whatever) - 1 === $i) // Close the ul
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment