| Do you know the difference between three equals (= =) and two equals (= =) in PHP? This article for everyone in detail, there is a need for friends, can see. To say the difference between PHP three equals (= =) and two equals (= =), take a look at an example: for example, a function will return the following cases: 1, more than 0 of the number 2, less than 0 of the number 3, is equal to 0 of the number (that is, 0) 4, False (when the failure), to catch and can not use = = because in addition to match the 4th case, will also match the 3rd case, because 0 is also false! The three equals sign represents the same type of comparison object. A two equal sign means that the condition is satisfied as long as the value is equal. Add: $a = ' 2 ';//character 2$b=2;//numeric 2$a== $b, is right, all 2$a=== $b, is wrong, because $ A is a character type $b is a numeric type, although the value is the same, but the type is different. There is the "linvo1986-level six" said the kind of "0". |