Re: incrementing in a for loop
| From: | Stephen Johnson | Date: | Mon, 12 Sep 2005 21:48:53 +0000 |
| Subject: | Re: incrementing in a for loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222218@lists.php.net to get a copy of this message | ||
You are correct -- forgive the typo (I forgot the = ).
That is what I get trying to reply to email while eating a burrito and
talking on the phone. LOL
<?php
/*
Stephen Johnson c | eh
The Lone Coder
http://www.ouradoptionblog.com
Join our journey of adoption
http://www.thelonecoder.com
stephen@thelonecoder.com
continuing the struggle against bad code
*/
?>
> From: "M. Sokolewicz" <tularis@php.net>
> Date: Mon, 12 Sep 2005 23:48:05 +0200
> To: Stephen Johnson <php@thelonecoder.com>
> Cc: Peppy <peppy@foxedge.net>, <php-general@lists.php.net>
> Subject: Re: [PHP] incrementing in a for loop
>
>
>>
>>
> that won't work; have you tried it?
> Because $i++ assigns the result of $i+1 to $i, while yours does not
> assign anything to $i. This means you'll run an eternal loop ;)
> to do what you showed, you'll need to change $i+5 to $i=$i+5 or $i += 5