<?
$str=1;
$type=gettype($str);
echo $type;
?>返回的字符串的可能值为: 
“boolean”(从 PHP 4 起)“integer”“double”(由于历史原因,如果是浮点型则返回“double”,而不是“float”)“string”“array”“object”“resource”(从 PHP 4 起)“NULL”(从 PHP 4 起)“user function”(只用于 PHP 3,现已停用)“unknown type”
对于 PHP 4,你应该使用 function_exists() 和 method_exists() 取代先前将 gettype() 作用于函数的用法。 相关函数:
settype()
is_array()
is_bool()
is_float()
is_integer()
is_null()
is_numeric()
is_object()
is_resource()
is_scalar() 
is_string()