小白教程
所有教程
关于
Search
172.70.178.131
172.70.178.131
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Php is iterable function”的源代码
本页内容
上一节:
Php_is_callable_function
下一节:
Php_is_int_function
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:is_iterable}}[[Category:php variable handling functions|18]] = PHP is_iterable() 函数 = [[php variable handling functions|PHP 可用的函数]] '''is_iterable()''' 函数用于检测变量的是否是一个可迭代的值。 PHP 版本要求: PHP 7 >= 7.1.0 === 语法 === <sample title="" desc="" lang="php" hererun="1"> bool is_iterable ( mixed $var ) </sample> 参数说明: * $var:要检测的变量,可以是数组或者实现 Traversable 接口的对象。 === 返回值 === 如果指定变量是个可迭代的对象则返回 TRUE,否则返回 FALSE。 == <sample title="" desc="" lang="php" hererun="1"> <?php var_dump(is_iterable([1, 2, 3])); // bool(true) var_dump(is_iterable(new ArrayIterator([1, 2, 3]))); // bool(true) var_dump(is_iterable((function () { yield 1; })())); // bool(true) var_dump(is_iterable(1)); // bool(false) var_dump(is_iterable(new stdClass())); // bool(false) ?> </sample> 输出结果为: <sample title="" desc="" lang="php" hererun="1"> bool(true) bool(true) bool(true) bool(false) bool(false) </sample> [[php variable handling functions|PHP 可用的函数]]
返回至“
Php is iterable function
”。
上一节:
Php_is_callable_function
下一节:
Php_is_int_function