Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why do we use == rather than ===
#8
(10-11-2010, 09:12 AM)Disease Wrote: Nor would the equals (==) operator. "Hey" and "hey" are not equal; 4 and "4" are equal but not identical. The equals operator does not eliminate case sensitivity. In order to do that you'd need to use a function such as strcasecmp () or strtolower ()/strtoupper (). The difference being that strcmp ()/strcasecmp () are binary safe and the equals/identical operators are not.

And Orgy, no, (1 === "1") would return false. They are equal (1 == "1") but they are not identical due to the difference in data type. The LHV is an integer and the RHV is a string literal.

Yeah I tested all of that shortly after asking, and found that all out. Nice to know
[Image: TYzKF.png]
Reply


Messages In This Thread
Why do we use == rather than === - by Orgy - 10-11-2010, 06:39 AM
RE: Why do we use == rather than === - by Disease - 10-11-2010, 06:42 AM
RE: Why do we use == rather than === - by Disease - 10-11-2010, 09:12 AM
RE: Why do we use == rather than === - by Orgy - 10-11-2010, 09:27 AM
RE: Why do we use == rather than === - by Orgy - 10-11-2010, 06:45 AM
RE: Why do we use == rather than === - by Orgy - 10-11-2010, 06:57 AM
RE: Why do we use == rather than === - by Chimi - 12-06-2010, 01:29 AM
RE: Why do we use == rather than === - by Orgy - 12-09-2010, 06:23 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)