#26209 [Opn->Csd]: 'continue' feature or bug?
| From: | didou@php.net | Date: | Fri, 14 Nov 2003 16:32:01 +0000 |
| Subject: | #26209 [Opn->Csd]: 'continue' feature or bug? | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969356928@lists.php.net to get a copy of this message | ||
ID: 26209
Updated by: didou@php.net
Reported By: marrtins at hackers dot lv
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: w2k,sp4
PHP Version: 4.3.3
New Comment:
This have been fixed in CVS.
I have added an example of what we shouldn't do when using continue,
guess who wrote it ? ;)
http://news.php.net/article.php?group=php.doc&article=969356927
Previous Comments:
------------------------------------------------------------------------
[2003-11-12 08:14:06] didou@php.net
From the documentation :
"continue accepts an optional numeric argument which tells it how many
levels of enclosing loops it should skip to the end of."
and we see that :
var_dump(print "$r\n"); // int(1)
you see your problem here ? Anyway, the documentation should have a
warning to avoid confusion.
didou
------------------------------------------------------------------------
[2003-11-11 16:23:52] marrtins at hackers dot lv
Description:
------------
strnge things happen (at least undocumented) with continue control
structure when using continue with and w/o semicolon
in example below continue w/o semi reproduces 2
with semi as expected 0,1,3 and 4
Reproduce code:
---------------
<?
for($r = 0; $r < 5; ++$r) {
if($r == 2)
continue
print "$r\n";
}
?>
Expected result:
----------------
0
1
3
4
Actual result:
--------------
2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26209&edit=1