Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update switch docs for new == rules #1196

Open
lexidor opened this issue Apr 5, 2022 · 1 comment · May be fixed by #1342
Open

Update switch docs for new == rules #1196

lexidor opened this issue Apr 5, 2022 · 1 comment · May be fixed by #1342
Assignees

Comments

@lexidor
Copy link
Contributor

lexidor commented Apr 5, 2022

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
@lexidor lexidor self-assigned this Apr 5, 2022
@AndrewDiMola
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants