RE: [PHP] Feelin' dumb...
| From: | Craig Vincent | Date: | Sat, 18 May 2002 03:55:33 +0000 |
| Subject: | RE: [PHP] Feelin' dumb... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98214@lists.php.net to get a copy of this message | ||
> I wonder why the other suggestions weren't working. They seemed logical
> enough, I even tried variations of your suggestion, first I tried:
>
> for ($i=1; $i<=$num_pages; $number = $i + 20) {}
> for ($i=1; $i<=$num_pages;) { $number = $i + 20; }
The problem with these two statements was that the loop would be indefinate.
Without the third option $i is never incremented (unless you manually
increment it from within the loop). So with your examples $i would always
be 1 and would therefore always be <= $num_pages unless $num_pages was zero
or negative.
Sincerely,
Craig Vincent