RE: [PHP] Feelin' dumb...

From: Date: Sat, 18 May 2002 03:35:45 +0000
Subject: RE: [PHP] Feelin' dumb...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-98210@lists.php.net to get a copy of this message
> For each loop, I want to add 20 to $i, so after the first > iteration, I have > 21, then 41, 61, etc. I've tried $i+20, $i + 20, I've tried looking in the > manual, but I assume this is some C-type function, and I'm not > familiar with > C! Well this is a bit of a detour from the other suggestions however since you haven't gotten a successful solution yet how about for ($i=1; $i<=$num_pages; $i++) { $number = ($i * 20) + 1; // print stuff here } The results would be $number = 21 on first run, then 41, then 61 etc (which I believe is what you are looking for). Note the parenthesis in the $number line are not needed however I typically code with them as it makes it easier to understand the code with less though =) Sincerely, Craig Vincent

« previous php.general (#98210) next »