The difference between three equal signs () and two equal signs () in php is analyzed. First, give a column. for example, a function will return the following situations: 1. number greater than 0 2. number less than 0 3. number equal to 0 (that is, 0) 4. False (upon failure) if you
First, give a column:
For example, a function returns the following results:
1. number greater than 0
2. number smaller than 0
3. number equal to 0 (that is, 0)
4. False (upon failure)
In this case, if you want to capture the failure, you must use = instead of =
Because = matches 4th cases and 3rd cases, because 0 is false!
The three equal signs indicate that the types of comparison objects must be consistent. The two equal signs indicate that the conditions are met as long as the values are equal.
Let's add:
$ A = '2'; // balanced type 2
$ B = 2; // numeric type 2
$ A = $ B, yes, both are 2
$ A ===$ B, which is incorrect because $ a is numeric and $ B is numeric. although the values are the same, they are of different types.
There is also the "0" that "linvo1986-" said.
For example, a function returns the following situations: 1. number greater than 0 2. number less than 0 3. number equal to 0 (that is, 0) 4. False (upon failure) if you...