Copy code The code is as follows:
$a = '212345678912000005';
$b = '212345678912000001';
var_dump ($a == $b);
The output of this code is bool(true), which means that this judgment will conclude that the two are equal. Similar characteristics are in the in_array() function When the three parameters are false or not set. The reason is to first determine whether the string is a number, then convert it to long or double (C language data type) and then determine - use zendi_smart_strcmp. However, the comments in the source code say that the statement considers overflow In the case of {
/* Both values overflowed and have the same sign,
* so a numeric comparison would be inaccurate */ goto string_cmp; }
dval1 and dval2 They are the values after converting the two strings into double types. But why is this still the case? Maybe this judgment is not correct. Let’s study further...
Solution, use three equal signs "== ="Instead of two equal signs "==", the in_array() function sets the third parameter to true: in_array('val', $array, true).
http://www.bkjia.com/PHPjc/320772.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/320772.html
TechArticleCopy the code as follows: $a = '212345678912000005'; $b = '212345678912000001'; var_dump($a = = $b); The output of this code is bool(true), which means that this judgment will lead to the conclusion that the two are consistent...