r/programming • • Mar 26 '14

JavaScript Equality Table

http://dorey.github.io/JavaScript-Equality-Table/
809 Upvotes

331 comments sorted by

View all comments

Show parent comments

33

u/Zecc Mar 26 '14

It gets better:

true == "php" == 0 == false

4

u/[deleted] Mar 26 '14

PHP Parse error: syntax error, unexpected '==' (T_IS_EQUAL) in Command line code on line 1

3

u/Various_Pickles Mar 26 '14

We're using pseudo-code to /r/lolphp about the language's lovely capacity to make wild-ass guesses about what variables should evaluate to when placed in various type-casting situations.

Any sane language (even JavaScript, for most situations not going from <something> -> boolean) will instead politely tell you to GTFO.

-1

u/bp3959 Mar 26 '14

wild-ass guesses

There's no guessing involved, automatic type conversion is well documented and follows a specific set of rules. Also get this, YOU DON'T HAVE TO USE AUTOMATIC TYPE CONVERSION.

→ More replies (3)