What is the difference between three equal signs () and two equal signs () in php?
| Do you know the difference between three equal signs (=) and two equal signs (=) in php? This article will introduce you in detail. if you need it, you can check it out.
Let's talk about the difference between three equal signs (=) and two equal signs (=) in php. let's look at an example: 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 (when a failure occurs), capture failures, 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.
Supplement: $ A = '2'; // numeric 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. |