note 16149 added to language.operators.increment
| From: | cleong at letstalk dot com | Date: | Wed, 17 Oct 2001 23:52:17 +0000 |
| Subject: | note 16149 added to language.operators.increment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-19071@lists.php.net to get a copy of this message | ||
Note that the ++ and -- don't convert a boolean to an int. The following code will loop
forever.
function a($start_index) {
for($i = $start_index; $i < 10; $i++) echo "\$i = $i\n";
}
a(false);
This behavior is, of course, very different from that in C. Had me pulling out my hair for a while.
--
http://www.php.net/manual/en/language.operators.increment.php
http://master.php.net/manage/user-notes.php?action=edit+16149
http://master.php.net/manage/user-notes.php?action=delete+16149
http://master.php.net/manage/user-notes.php?action=reject+16149