小白教程
所有教程
关于
Search
172.70.178.233
172.70.178.233
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Php gettype function”的源代码
本页内容
上一节:
Php_get_resource_type_function
下一节:
Php_import_request_variables_function
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:gettype}}[[Category:php variable handling functions|8]] = PHP gettype() 函数 = [[php variable handling functions|PHP 可用的函数]] '''gettype()''' 函数用于获取变量的类型。 <blockquote>'''注意''':不要使用 '''gettype()''' 来测试某种类型,因为其返回的字符串在未来的版本中可能需要改变。此外,由于包含了字符串的比较,它的运行也是较慢的。使用 is_* 函数代替。 </blockquote> 版本要求:PHP 4, PHP 5, PHP 7 === 语法 === <sample title="" desc="" lang="php" hererun="1"> string gettype ( mixed $var ) </sample> 参数说明: * $var:变量。 === 返回值 === 返回字符串,可能值为: * boolean * integer * double * string * array * object * resource * NULL * unknown type == <sample title="" desc="" lang="php" hererun="1"> <?php echo gettype(102) . PHP_EOL; echo gettype(true) . PHP_EOL; echo gettype(' ') . PHP_EOL; echo gettype(null) . PHP_EOL; echo gettype(array()) . PHP_EOL; echo gettype(new stdclass()); ?> </sample> 输出结果为: <sample title="" desc="" lang="php" hererun="1"> integer boolean string NULL array object </sample> [[php variable handling functions|PHP 可用的函数]]
返回至“
Php gettype function
”。
上一节:
Php_get_resource_type_function
下一节:
Php_import_request_variables_function