false
false
false
false
false
false
false
false
using PHP functions to $x compare variables
An expression |
GetType () |
empty () |
is_null () |
isset () |
boolean : if ($x) |
$x = ""; |
string |
true |
false |
true |
false |
$x = null; |
null |
true |
true |
false |
false |
var $x; |
null |
true |
true |
false |
false |
$x was undefined |
null |
TRUE |
TRUE |
FALSE |
FALSE |
$x = Array (); |
array |
true |
false |
true |
false |
$x = false; |
boolean |
true |
false |
true |
false |
$x = true; |
boolean |
false | TD align= "left" >
true |
true |
$x = 1; |
integer |
false | TD align= "left" >
true |
true |
$x =; |
integer |
false | TD align= "left" >
true |
true |
$x = 0; |
integer |
true |
false |
true |
false |
$x =-1; |
integer |
false | TD align= "left" >
true |
true |
$x = "1"; |
string |
false | TD align= "left" >
true |
true |
$x = "0"; |
string |
true |
false |
true |
false |
$x = "1"; |
string |
false | TD align= "left" >
true |
true |
$x = "php"; |
string |
false | TD align= "left" >
true |
true |
$x = "true"; |
string |
false | TD align= "left" >
true |
true |
$x = "false"; |
String |
FALSE |
FALSE |
TRUE |
TRUE |
The above is the usual development of the attention, there are questions you can verify the next Kazakhstan welcome
PHP Variable Boolean validation