note 47244 added to control-structures.for
| From: | eistoeter at gmx dot de | Date: | Mon, 08 Nov 2004 14:09:05 +0000 |
| Subject: | note 47244 added to control-structures.for | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-80281@lists.php.net to get a copy of this message | ||
Joseph Wamicha
19-Oct-2004 09:12
wrote:
Not initializing $i in for loop will have it initialize to 1.
This is correct but if you have another loop and you need again $i you'll have to set it
yourself to 1
Example:
<?php
// prints 1-9
for($i;$i<10;$i++)
{
echo $i."<br>";
}
// prints nothing because $i is already 10
for($i;$i<10;$i++)
{
echo $i."<br>";
}
?>
----
Manual Page -- http://www.php.net/manual/en/control-structures.for.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47244
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47244&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47244&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47244&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47244&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47244&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47244&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47244&report=yes
Search -- http://master.php.net/manage/user-notes.php