Phpboolfalse and numeric 0 to: http://home.phpchina.com/space.php? Uid = 108724 & amp; do = blog & amp; id = 54899PHP is a loose language, which means that the Boolean value false and integer value 0 are regarded as php bool false and value 0.
Turn: http://home.phpchina.com/space.php? Uid = 108724 & do = blog & id = 54899
PHP is a loose language, which means that Boolean values false and integer values 0 are considered the same (even c treats 0 and false as equivalent ). Can I use a script to determine the values of 0 and boolean? The equivalence of false :? ? $ Test_var = 0;
? If ($ test_var = false ){
?? Echo "yes ";
?} Else {
?? Echo "no ";
?}
?> ?? Output: yes? _________________________________________________________________________________? ? $ Test_var = 0;
? If ($ test_var! = False ){
?? Echo "yes ";
?} Else {
?? Echo "no ";
?}
?>? Output: yes? _________________________________________________________________? The problem is that the Boolean value false is obviously different from the integer value 0 .?? PHP has a gettype () function to obtain the variable type. You can use the = operator (after reading it, there are three equal signs ). The difference between the = operator and the = operator is that the operator is both
Compare data values and types.?
When different variable types are involved in the conditions for termination, use? ===And ?! = It is very important to perform a strong type check for operators.
?