note 46574 added to control-structures.for

From: Date: Fri, 15 Oct 2004 19:31:45 +0000
Subject: note 46574 added to control-structures.for
Groups: php.notes 
Request: Send a blank email to php-notes+get-78603@lists.php.net to get a copy of this message
as harbater at teamgenesis dot com noted, don't use a comma to separate conditions in expr2. But if you do, the result will be ONLY the last condition being evaluated for the continuation of the loop. So this would iterate infinitely: for(; false, true;); and if you swapped the true and false it would break immediately. I wouldn't count using a comma completely out of the question, since there may be a rare circumstance where you would only want to break if the last evaluation returns false. ---- Manual Page -- http://www.php.net/manual/en/control-structures.for.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46574 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46574&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46574&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46574&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46574&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46574&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46574&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46574&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78603) next »