note 77171 added to function.is-int
| From: | matt at mattkemp dot co dot uk | Date: | Fri, 17 Aug 2007 19:53:29 +0000 |
| Subject: | note 77171 added to function.is-int | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129567@lists.php.net to get a copy of this message | ||
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 ;)
----
Server IP: 194.145.210.4
Probable Submitter: 82.118.96.232
----
Manual Page -- http://www.php.net/manual/en/function.is-int.php
Edit -- https://master.php.net/note/edit/77171
Del: integrated -- https://master.php.net/note/delete/77171/integrated
Del: useless -- https://master.php.net/note/delete/77171/useless
Del: bad code -- https://master.php.net/note/delete/77171/bad+code
Del: spam -- https://master.php.net/note/delete/77171/spam
Del: non-english -- https://master.php.net/note/delete/77171/non-english
Del: in docs -- https://master.php.net/note/delete/77171/in+docs
Del: other reasons-- https://master.php.net/note/delete/77171
Reject -- https://master.php.net/note/reject/77171
Search -- https://master.php.net/manage/user-notes.php