Re: Banner Ad Script
| From: | Doug Semig | Date: | Wed, 12 Jul 2000 02:45:30 +0000 |
| Subject: | Re: Banner Ad Script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6054@lists.php.net to get a copy of this message | ||
At first glance, it might be because you used $i in your while() statement
and, within that, you used it again in a for() statement. You might change
the for() statement's iterator variable to something you aren't depending
on, like $j, and give that a try.
Doug
Andrew was heard at 04:50 PM 7/11/00 -0700 to say:
>Hello,
>
> I'm working on a banner ad rotation script in PHP. The following is the
>code I came up with; however, at times it exceeds the maximum execution time
>and other times it works fairly fast. Any ideas...
>
>Code Sample:
... snip ...
> // THE SCRIPT CHOKES HERE
> while ($i != $max) {
> mt_srand ((double) microtime () * 1000000);
> $picked_ad = mt_rand (1, count ($ids));
> for ($i = 0; $i < count ($used_ads); $i++) {
> if ($ids[$picked_ad] == $used_ads[$i])
> $used = true;
> }
... snip ...