Skip to content

Instantly share code, notes, and snippets.

@jgambill
Created April 10, 2014 16:57
Show Gist options
  • Save jgambill/10401942 to your computer and use it in GitHub Desktop.
Save jgambill/10401942 to your computer and use it in GitHub Desktop.
create css classes to alternate row color of a list of items using mod function #php #basics
<?php
// assuming a loop where i is incremented
if ($i % 2 == 1) $classes .= " odd";
else $classes .= " even";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment