note 72989 added to function.next
| From: | gg2005 at gmail dot com | Date: | Tue, 06 Feb 2007 21:32:13 +0000 |
| Subject: | note 72989 added to function.next | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122944@lists.php.net to get a copy of this message | ||
Don't confuse next with continue!
If you're a Perl developer starting with PHP, you might try to use "next" inside a
loop to skip to the next iteration...
i.e.,
foreach ($things as $thing) {
if (something I don't like about $thing) {
next;
}
blah....
}
The php compiler will take next... but it's not going to work.
Do this instead:
foreach ($things as $thing) {
if (something I don't like about $thing) {
continue;
}
blah....
}
----
Server IP: 216.194.113.175
Probable Submitter: 70.225.165.48
----
Manual Page -- http://www.php.net/manual/en/function.next.php
Edit -- https://master.php.net/note/edit/72989
Del: integrated -- https://master.php.net/note/delete/72989/integrated
Del: useless -- https://master.php.net/note/delete/72989/useless
Del: bad code -- https://master.php.net/note/delete/72989/bad+code
Del: spam -- https://master.php.net/note/delete/72989/spam
Del: non-english -- https://master.php.net/note/delete/72989/non-english
Del: in docs -- https://master.php.net/note/delete/72989/in+docs
Del: other reasons-- https://master.php.net/note/delete/72989
Reject -- https://master.php.net/note/reject/72989
Search -- https://master.php.net/manage/user-notes.php