mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
bugfixing #26209
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@144354 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
576e684a19
commit
59543d885a
1 changed files with 44 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.81 $ -->
|
||||
<!-- $Revision: 1.82 $ -->
|
||||
<chapter id="control-structures">
|
||||
<title>Control Structures</title>
|
||||
|
||||
|
@ -750,6 +750,49 @@ while ($i++ < 5) {
|
|||
</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">
|
||||
|
|
Loading…
Reference in a new issue