First look at a special case:
Var_dump (0 = = ' false '), returns BOOL (true), PHP determines 0 equals any string;
Var_dump (0=== ' false '), which returns BOOL (FALSE), which contains both the type and the value in order to be equal.
Var_dump (0 = = false), returns BOOL (true),
Causes of the above results (translated from the official PHP document):
1, for the bool type:
When you output the bool type or use it in a statement, it is converted to a number , andtrue becomes 1and False becomes 0.
For example $a = true; Var_dump ($a + 1), return (int) 2; The $a is converted to 1, and the sum is 2;
A bool variable expresses a true value, not a 0 or a 1; A Boolean is not a symbolic constant, they are valued.
2, String type:
PHP always automatically attempts to convert a string into a digital type. such as Var_dump (' abc ' +3 '), return int (3),
First ' ABC ' is converted to the number 0, and the addition becomes 3;
Methods for detecting the type of a variable:
1, Var_dump ($param), returns the type and value of the variable.
2. Use Is_int (), Is_bool (), is_string (), function, return True and false,
Common types of conversion methods.
Variable $param
Integral type (int) $param
Character type (string) $param
Boolean type (BOOL) $param
Another way to convert to Boolean: $a =!5, $a false , $a =!! 5,$a is true;
The above describes the reason why php 0 = = false,0 = False will be equal, and false! = False. , including the aspects of the content, want to be interested in PHP tutorial friends helpful.