note 42850 added to control-structures.for
| From: | moniarde at yahoo dot com | Date: | Tue, 01 Jun 2004 01:06:30 +0000 |
| Subject: | note 42850 added to control-structures.for | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70377@lists.php.net to get a copy of this message | ||
As previously mentioned,
<?
for ($i = a; $i <= z; $i++) {
echo $i
}
?>
will print a -> z, then aa, ba, ca , etc -> yz. However, doing this:
<?
for ($i = a; ; $i++) {
echo $i;
if ($i == "z") {
break;
}
}
?>
will print only a->z. It's simple, but it works.
----
Manual Page -- http://www.php.net/manual/en/control-structures.for.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42850
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42850&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42850&report=yes
Search -- http://master.php.net/manage/user-notes.php