Return to Snippet

Revision: 47197
at June 2, 2011 08:10 by mindshare


Initial Code
$i = 0;
// start loop
$alt = ($i%2) ? 'even' : 'odd';
// echo the result, etc
$i++;
// end loop

/* usage:
 - place inside a loop
 - increment the $i variable at the end of the loop
*/

Initial URL

                                

Initial Description
Use this to add alternating rows in PHP.

Initial Title
Super-short PHP Even / Odd Alternator

Initial Tags
css

Initial Language
PHP