note 77171 deleted from function.is-int by nlopess
| From: | nlopess@php.net | Date: | Tue, 04 Sep 2007 14:26:04 +0000 |
| Subject: | note 77171 deleted from function.is-int by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-130164@lists.php.net to get a copy of this message | ||
Note Submitter: matt at mattkemp dot co dot uk
----
I've found a much better way of making table rows is something like this:
<?php
echo '<table>';
for ($i = 0; i<15; i++)
{
echo '<tr class="row'.($i%2).'">';
echo '<td>table_data</td>';
echo '</tr>';
}
echo '</table>';
*/ If youre not using CSS, then just swap in the if: */
echo '<table>';
for ($i = 0; i<15; i++)
{
if (i%2 == 0) echo '<tr bgcolor="aqua">';
else echo '<tr bgcolor="white">';
echo '<td>table_data</td>';
echo '</tr>';
}
echo '</table>';
?>
Using modulo arithmetic should be faster than calling is_int() with every table row. Every little
helps when you have 12,000 line table ;)