<?
$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()
$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()
取得变数的型态。语法: string gettype(mixed var);传回值: 字串函式种类: PHP 系统功能内容说明 本函式用来取得变数的型态。传回的型态字串可能为下列字串其中之一:integer、double、string、array、object、unknown type。通常无须判断,php是弱类型语言,会自动识别、转换