mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
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> git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@339487 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
0b626f05d2
commit
762d0209c2
1 changed files with 1 additions and 7 deletions
|
@ -108,7 +108,7 @@ switch ($i) {
|
|||
<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
|
||||
|
@ -196,12 +196,6 @@ switch ($i) {
|
|||
</programlisting>
|
||||
</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
|
||||
|
|
Loading…
Reference in a new issue