Peppy wrote:
I've searched online and am unable to find how to increment by more than one in
a for loop.
for ($i = 1; $i = 6; $i++) {
Is it possible to increment $i by 5?
Everyone has responded with the correct answer, but you do realize that
this loop will only run twice? It will print 1,
I've searched online and am unable to find how to increment by more than one in
a for loop.
for ($i = 1; $i = 6; $i++) {
Is it possible to increment $i by 5?
Thanks.
I've searched online and am unable to find how to increment by more than
one in a for loop.
for ($i = 1; $i = 6; $i++) {
Is it possible to increment $i by 5?
Sure.
for ($i = 1; $i = 6; $i+=5) {
-philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
On 9/12/05 12:39 PM, Peppy [EMAIL PROTECTED] wrote:
for ($i = 1; $i = 6; $i++) {
Is it possible to increment $i by 5?
for ($i = 1; $i = 6; $i+5) {
--
Stephen Johnson
The Lone Coder
http://www.ouradoptionblog.com
*Join us on our adoption journey*
[EMAIL PROTECTED]
this worked for me:
[CODE]
for ($myLoop = 0; $myLoop 100; $myLoop= $myLoop + 5)
{
print Pmy loop: $myLoop;
}
[/CODE]
Peppy wrote:
I've searched online and am unable to find how to increment by more than one in
a for loop.
Stephen Johnson wrote:
On 9/12/05 12:39 PM, Peppy [EMAIL PROTECTED] wrote:
for ($i = 1; $i = 6; $i++) {
Is it possible to increment $i by 5?
for ($i = 1; $i = 6; $i+5) {
that won't work; have you tried it?
Because $i++ assigns the result of $i+1 to $i, while yours does not
assign
PROTECTED]
continuing the struggle against bad code
*/
?
From: M. Sokolewicz [EMAIL PROTECTED]
Date: Mon, 12 Sep 2005 23:48:05 +0200
To: Stephen Johnson [EMAIL PROTECTED]
Cc: Peppy [EMAIL PROTECTED], php-general@lists.php.net
Subject: Re: [PHP] incrementing in a for loop
D A GERM mailto:[EMAIL PROTECTED]
on Monday, September 12, 2005 1:01 PM said:
[CODE]
for ($myLoop = 0; $myLoop 100; $myLoop= $myLoop + 5)
{
print Pmy loop: $myLoop;
}
[/CODE]
Where's the code?
Oh there it is!
8 matches
Mail list logo