From 762d0209c2940e8e53eaca0352a670f87621b82b Mon Sep 17 00:00:00 2001 From: Christoph Michael Becker Date: Sat, 25 Jun 2016 11:20:17 +0000 Subject: [PATCH] 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: git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@339487 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/control-structures/switch.xml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/language/control-structures/switch.xml b/language/control-structures/switch.xml index bed8699827..8d6d748413 100644 --- a/language/control-structures/switch.xml +++ b/language/control-structures/switch.xml @@ -108,7 +108,7 @@ switch ($i) { switch statement executes line by line (actually, statement by statement). In the beginning, no code is executed. Only when a case statement is found - with a value that matches the value of the + whose expression evaluates to a value that matches the value of the switch expression does PHP begin to execute the statements. PHP continues to execute the statements until the end of the switch block, or the first time it sees @@ -196,12 +196,6 @@ switch ($i) { - - The case expression may be any expression that - evaluates to a simple type, that is, integer or floating-point - numbers and strings. Arrays or objects cannot be used here unless - they are dereferenced to a simple type. - The alternative syntax for control structures is supported with switches. For more information, see