$v= | NULL | 0 | FALSE | "" | TRUE | 1 | 1.3 | -1 | "-1" | -1.7 | "1" | "1.3" | "0" | " " | "string" | "123str" | "str123" | array() | array(1) | unset($v) |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
isset($v) | false | true | true | true | true | true | true | true | true | true | true | true | true | true | true | true | true | true | true | false |
if ($v) { | false | false | false | false | true | true | true | true | true | true | true | true | false | true | true | true | true | false | true | false |
empty($v) | true | true | true | true | false | false | false | false | false | false | false | false | true | false | false | false | false | true | false | true |
$v == '' | true | true | true | true | false | false | false | false | false | false | false | false | false | false | false | false | false | false | false | true |
is_scalar($v) | false | true | true | true | true | true | true | true | true | true | true | true | true | true | true | true | true | false | false | false |
is_bool($v) | false | false | true | false | true | false | false | false | false | false | false | false | false | false | false | false | false | false | false | false |
is_string($v) | false | false | false | true | false | false | false | false | true | false | true | true | true | true | true | true | true | false | false | false |
is_int($v) | false | true | false | false | false | true | false | true | false | false | false | false | false | false | false | false | false | false | false | false |
is_numeric($v) | false | true | false | false | false | true | true | true | true | true | true | true | true | false | false | false | false | false | false | false |
is_float($v) | false | false | false | false | false | false | true | false | false | true | false | false | false | false | false | false | false | false | false | false |
is_null($v) | true | false | false | false | false | false | false | false | false | false | false | false | false | false | false | false | false | false | false | true |
is_array($v) | false | false | false | false | false | false | false | false | false | false | false | false | false | false | false | false | false | true | true | false |
ctype_digit($v) | false | false | false | false | false | false | false | false | false | false | true | false | true | false | false | false | false | false | false | false |
ctype_alnum($v) | false | false | false | false | false | false | false | false | false | false | true | false | true | false | true | true | true | false | false | false |
ctype_lower($v) | false | false | false | false | false | false | false | false | false | false | false | false | false | false | true | false | false | false | false | false |
ctype_print($v) | false | false | false | false | false | false | false | false | true | false | true | true | true | true | true | true | true | false | false | false |
ctype_space($v) | false | false | false | false | false | false | false | false | false | false | false | false | false | true | false | false | false | false | false | false |
ctype_cntrl($v) | false | true | false | false | false | true | false | false | false | false | false | false | false | false | false | false | false | false | false | false |
ctype_graph($v) | false | false | false | false | false | false | false | false | true | false | true | true | true | false | true | true | true | false | false | false |
$v= | NULL | 0 | FALSE | "" | TRUE | 1 | 1.3 | -1 | "-1" | -1.7 | "1" | "1.3" | "0" | " " | "string" | "123str" | "str123" | array() | array(1) | unset($v) |
count($v) | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 |
gettype($v) | NULL | integer | boolean | string | boolean | integer | double | integer | string | double | string | string | string | string | string | string | string | array | array | NULL |
intval($v) | 0 | 0 | 0 | 0 | 1 | 1 | 1 | -1 | -1 | -1 | 1 | 1 | 0 | 0 | 0 | 123 | 0 | 0 | 1 | 0 |
floatval($v) | 0 | 0 | 0 | 0 | 1 | 1 | 1.3 | -1 | -1 | -1.7 | 1 | 1.3 | 0 | 0 | 0 | 123 | 0 | 0 | 1 | 0 |
strlen($v) | 0 | 1 | 0 | 0 | 1 | 1 | 3 | 2 | 2 | 4 | 1 | 3 | 1 | 1 | 6 | 6 | 6 | 0 | ||
strval($v) | '' | '0' | '' | '' | '1' | '1' | '1.3' | '-1' | '-1' | '-1.7' | '1' | '1.3' | '0' | ' ' | 'string' | '123str' | 'str123' | 'Array' | 'Array' | '' |
floor($v) | 0 | 0 | 0 | 0 | 1 | 1 | 1 | -1 | -1 | -2 | 1 | 1 | 0 | 0 | 0 | 123 | 0 | false | false | 0 |
ceil($v) | 0 | 0 | 0 | 0 | 1 | 1 | 2 | -1 | -1 | -1 | 1 | 2 | 0 | 0 | 0 | 123 | 0 | false | false | 0 |
round($v) | 0 | 0 | 0 | 0 | 1 | 1 | 1 | -1 | -1 | -2 | 1 | 1 | 0 | 0 | 0 | 123 | 0 | false | false | 0 |
$v= | NULL | 0 | FALSE | "" | TRUE | 1 | 1.3 | -1 | "-1" | -1.7 | "1" | "1.3" | "0" | " " | "string" | "123str" | "str123" | array() | array(1) | unset($v) |
Hide Dumps/Include Dumps
$arr = array ( 'zero' => 0, 'one' => 1, 'three' => 'Three', 'null' => NULL, 'false' => false, 'empty' => '', ); |
|
In case interested all these tests are carried out live as this page is rendered, so any upgrade of PHP will immediately show up. If you have a different version of PHP, and would like to host a copy then let Barry know.
Original hosted at deformedweb.co.uk. Comments/Suggestions/Donations etc to Barry (c)2005