note 47244 deleted from control-structures.for by didou
| From: | didou@php.net | Date: | Mon, 08 Nov 2004 14:21:28 +0000 |
| Subject: | note 47244 deleted from control-structures.for by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-80284@lists.php.net to get a copy of this message | ||
Note Submitter: eistoeter at gmx dot de
----
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>";
}
?>
----
Reason: useless example