user-documentation
user-documentation copied to clipboard
Update switch docs for new == rules
Please complete the information below:
Where is the problem?
$v = 30;
switch ($v) {
case 30.0: // <===== this case matches with 30
...
break;
default:
...
break;
case 30: // <===== rather than this case matching with 30
...
break;
}
What is the problem?
30 and 30.0 are not considered equal under the new ==
equality operator.
Please don't change anything below this point.
- Build ID: HHVM=HHVM-4.154.0:HSL=v4.108.1:2022-04-04T22:45:12+0000:1fa47f258c6b68f8ec01899aa82fd6ffa0957109
- Page requested: /hack/statements/switch
- Page requested at: Tue, 05 Apr 2022 20:05:23 +0000
Yikes. You're right, but there's also a much larger problem: the equality page is hideously out of date. I'm going to update it ASAP then update the switch page accordingly.