Re: Please help!
| From: | Justin Buist | Date: | Wed, 22 Aug 2001 20:05:33 +0000 |
| Subject: | Re: Please help! | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-11684@lists.php.net to get a copy of this message | ||
I realize this is trivial... but if you're using things like the code
below alot it can clean things up a bit by using:
if (($counter % 2) == 0 && ($counter != 0))
echo "<BR>";
$counter++;
echo "<img src=whatever...>\n";
Just reads easier... less branching, less code. In an ideal world it'd
optimize into machine code better than the below snippet too -- but that's
get anal retentive about the situtation :)
Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI 49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612
On Wed, 22 Aug 2001, Marios Moutzouris wrote:
>
> use that counter variable. check if its equal to 2 before incrementing, if
> it is then "<BR>" and reset to zero, otherwise just increment.
>
> if ($counter==2) {
> echo "<BR>";
> $counter=0;
> } else {
> $counter++;
> }