Return to Snippet

Revision: 23839
at February 15, 2010 08:02 by jrobinsonc


Initial Code
$i = 0;

foreach($rows as $row) {
	$class = ($i++ & 1) == 1 ? 'odd' : 'even';

	echo '<tr>';
	echo "<td class=\"{$class}\">{$row['name']}</td>";
	echo "<td class=\"{$class}\">{$row['phone']}</td>";
	echo '</tr>';

}

Initial URL

                                

Initial Description

                                

Initial Title
Colorear filas de una tabla par/impar con PHP

Initial Tags
php

Initial Language
PHP