svn: /phpdoc/en/trunk/language/control-structures/ switch.xml
| From: | Christoph Michael Becker | Date: | Sat, 25 Jun 2016 11:20:17 +0000 |
| Subject: | svn: /phpdoc/en/trunk/language/control-structures/ switch.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-14245@lists.php.net to get a copy of this message | ||
cmb Sat, 25 Jun 2016 11:20:17 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=339487
Log:
Fix #72491: Case can take objects and arrays
Indeed, there are no restrictions on the type that a case expression evaluates to.
That's conforming to the PHP language specification:
<https://github.com/php/php-langspec/blob/PHP-5.6/spec/11-statements.md#the-switch-statement>
Bug: https://bugs.php.net/72491 (Verified) Case can take
objects and arrays
Changed paths:
U phpdoc/en/trunk/language/control-structures/switch.xml
Modified: phpdoc/en/trunk/language/control-structures/switch.xml
===================================================================
--- phpdoc/en/trunk/language/control-structures/switch.xml 2016-06-24 19:41:07 UTC (rev 339486)
+++ phpdoc/en/trunk/language/control-structures/switch.xml 2016-06-25 11:20:17 UTC (rev 339487)
@@ -108,7 +108,7 @@
<literal>switch</literal> statement executes line by line
(actually, statement by statement). In the beginning, no code is
executed. Only when a <literal>case</literal> statement is found
- with a value that matches the value of the
+ whose expression evaluates to a value that matches the value of the
<literal>switch</literal> expression does PHP begin to execute the
statements. PHP continues to execute the statements until the end
of the <literal>switch</literal> block, or the first time it sees
@@ -197,12 +197,6 @@
</informalexample>
</para>
<para>
- The <literal>case</literal> expression may be any expression that
- evaluates to a simple type, that is, <type>integer</type> or floating-point
- numbers and <type>string</type>s. <type>Array</type>s or
<type>object</type>s cannot be used here unless
- they are dereferenced to a simple type.
- </para>
- <para>
The alternative syntax for control structures is supported with
switches. For more information, see <link
linkend="control-structures.alternative-syntax">Alternative syntax