|
Expression |
gettype() |
empty() |
is_null() |
isset() |
boolean : if($x) |
| 1 |
$x = ""; |
string |
True |
False |
True |
False |
| 2 |
$x = NULL |
NULL |
True |
True |
False |
False |
| 3 |
var $x; |
NULL |
True |
True |
False |
False |
| 4 |
$x is undefined |
NULL |
True |
True |
False |
False |
| 5 |
$x = array(); |
array |
True |
False |
True |
False |
| 6 |
$x = false; |
boolean |
True |
False |
True |
False |
| 7 |
$x = true; |
boolean |
False |
False |
True |
True |
| 8 |
$x = 1; |
integer |
False |
False |
True |
True |
| 9 |
$x = 42; |
integer |
False |
False |
True |
True |
| 10 |
$x = 0; |
integer |
True |
False |
True |
False |
| 11 |
$x = -1; |
integer |
False |
False |
True |
True |
| 12 |
$x = "1"; |
string |
False |
False |
True |
True |
| 13 |
$x = "0"; |
string |
True |
False |
True |
False |
| 14 |
$x = "-1"; |
string |
False |
False |
True |
True |
| 15 |
$x = "php"; |
string |
False |
False |
True |
True |
| 16 |
$x = "true"; |
string |
False |
False |
True |
True |
| 17 |
$x = "false"; |
string |
False |
False |
True |
True |
|
empty("0") は、true となります
|