Why does "true" output 1, but "false" output nothing? & Lt ;? Php $ a = true; echo & nbsp; "output below & nbsp; true & nbsp; & lt; br & gt;"; echo & nbsp; $ a; echo & nbsp; '& lt; br & gt;'; $ a = false: Why does true output 1, but false does not output anything?
$ A = true;
Echo "output below true
";
Echo $;
Echo'
';
$ A = false;
Echo "output below false
";
Echo $;
?>
If it is actually converted to 1 output, then false should be converted to 0 output.
------ Solution --------------------
According to its rules, this is programming.
------ Solution --------------------
$ A = false;
Var_dump ($ );
Output:
Bool (false)
We recommend that you use var_dump () for debugging.
------ Solution --------------------
The author of the language writes this statement. when you write a language one day, "false" outputs 0 and "true" outputs nothing. then someone asks why "false" outputs 0 and "true" outputs nothing.
------ Solution --------------------
Php Boolean values true and false; // echo true; 1 echo false no output content
Like php and c, 0 indicates false; non-0 indicates true;
$ A = 1;
Echo "output below true
";
Echo $;
Echo'
';
$ A = 0;
Echo "output below false
";
Echo $;
------ Solution --------------------
For numeric types, false is indeed 0, and for string, false is null. although the number 0 is equal to the string Null, it cannot be said that bool is 0 After string conversion;
var_dump((int)false);
var_dump((string)false);
------ Solution --------------------
Reference:
The author of the language writes this statement. when you write a language one day, "false" outputs 0 and "true" outputs nothing. then someone asks why "false" outputs 0 and "true" outputs nothing.
..........