小白教程
所有教程
关于
Search
172.69.58.214
172.69.58.214
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Php is object function”的源代码
本页内容
上一节:
Php_is_numeric_function
下一节:
Php_is_float_function
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:is_object}}[[Category:php variable handling functions|22]] = PHP is_object() 函数 = [[php variable handling functions|PHP 可用的函数]] '''is_object()''' 函数用于检测变量是否是一个对象。 PHP 版本要求: PHP 4, PHP 5, PHP 7 === 语法 === <sample title="" desc="" lang="php" hererun="1"> bool is_object ( mixed $var ) </sample> 参数说明: * $var:要检测的变量。 === 返回值 === 如果指定变量为对象,则返回 TRUE,否则返回 FALSE。 == <sample title="" desc="" lang="php" hererun="1"> <?php function get_subjects($obj_name) { if(!is_object($obj_name)) { return(false); } return($obj_name->subjects); } $obj_name = new stdClass; $obj_name->subjects = Array('Google', 'xiaoBai', 'Facebook'); var_dump(get_subjects(NULL)); var_dump(get_subjects($obj_name)); ?> </sample> 输出结果为: <sample title="" desc="" lang="php" hererun="1"> bool(false) array(3) { [0]=> string(6) "Google" [1]=> string(6) "xiaoBai" [2]=> string(8) "Facebook" } </sample> [[php variable handling functions|PHP 可用的函数]]
返回至“
Php is object function
”。
上一节:
Php_is_numeric_function
下一节:
Php_is_float_function