$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) |
var_dump($v) | NULL | int(0) | bool(false) | string(0) "" | bool(true) | int(1) | float(1.3) | int(-1) | string(2) "-1" | float(-1.7) | string(1) "1" | string(3) "1.3" | string(1) "0" | string(1) " " | string(6) "string" | string(6) "123str" | string(6) "str123" | array(0) { } | array(1) { [0]=> int(1) } | NULL |
var_export($v) | NULL | 0 | false | '' | true | 1 | 1.3 | -1 | '-1' | -1.7 | '1' | '1.3' | '0' | ' ' | 'string' | '123str' | 'str123' | array ( ) | array ( 0 => 1, ) | NULL |
print_r($v) | '' | '0' | '' | '' | '1' | '1' | '1.3' | '-1' | '-1' | '-1.7' | '1' | '1.3' | '0' | ' ' | 'string' | '123str' | 'str123' | 'Array ( ) ' | 'Array ( [0] => 1 ) ' | '' |
serialize($v) | 'N;' | 'i:0;' | 'b:0;' | 's:0:"";' | 'b:1;' | 'i:1;' | 'd:1.3;' | 'i:-1;' | 's:2:"-1";' | 'd:-1.7;' | 's:1:"1";' | 's:3:"1.3";' | 's:1:"0";' | 's:1:" ";' | 's:6:"string";' | 's:6:"123str";' | 's:6:"str123";' | 'a:0:{}' | 'a:1:{i:0;i:1;}' | 'N;' |
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