Re: Patch for #26209
| From: | Gabor Hojtsy | Date: | Fri, 14 Nov 2003 11:05:22 +0000 |
| Subject: | Re: Patch for #26209 | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969356924@lists.php.net to get a copy of this message | ||
Seems to be fine to me;
Goba
Mehdi Achour wrote:
Hi ! Attached is a patch fixing http://bugs.php.net/26209 The bug could have been marked bogus, but this commit will maybe avoid some headaches.. any objection (or review) for it ? didou ------------------------------------------------------------------------ Index: control-structures.xml =================================================================== RCS file: /repository/phpdoc/en/language/control-structures.xml,v retrieving revision 1.81 diff -u -r1.81 control-structures.xml --- control-structures.xml 30 Sep 2003 08:40:06 -0000 1.81 +++ control-structures.xml 13 Nov 2003 23:31:13 -0000 @@ -750,6 +750,49 @@</programlisting> </informalexample> </para> + <para> + Ommiting the semicolon after <literal>continue</literal> can lead to + confusion. Here's an example of what you shouldn't do. + </para> + <para> + <informalexample> + <programlisting role="php">+<![CDATA[ +<?php + for ($i = 0; $i < 5; ++$i) {+ if ($i == 2) + continue + print "$i\n";+ } +?> +]]>+ </programlisting> + <para> + One can expect the result to be : + </para> + <screen>+<![CDATA[ +0 +1 +3 +4 +]]>+ </screen> + <para> + but this script will output : + </para> + <screen>+<![CDATA[ +2 +]]>+ </screen> + <para> + because the return value of the <function>print</function> + call is <literal>int(1)</literal>, and it will look like the + optional numeric argument mentionned above. + </para> + </informalexample> + </para></sect1> <sect1 id="control-structures.switch">