note 82468 deleted from control-structures.continue by nlopess

From: Date: Tue, 29 Apr 2008 18:03:18 +0000
Subject: note 82468 deleted from control-structures.continue by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-138904@lists.php.net to get a copy of this message
Note Submitter: bennet at mc dot edu ---- The first example above is: <?php while (list($key, $value) = each($arr)) { if (!($key % 2)) { // skip odd members continue; } do_something_odd($value); } ?> The comment could be misleading. The expression $key % 2 is true for odd values of $key, so the if is true and the continue is executed when $key is even. The comment could reasonably mean "for odd members, we skip the continue." But since I associate running the continue with "skipping" the remainder of the loop, I would comment this just the opposite way: "skip even members."

« previous php.notes (#138904) next »