PHP is_array() 函数

PHP 教程 · 2019-01-31 16:43:33

is_array() 函数用于检测变量是否是一个数组。

PHP 版本要求:PHP 4, PHP 5, PHP 7

语法

bool is_array ( mixed $var )

参数说明:

  • $var:要检测的变量。

返回值

如果检测的变量是数组,则返回 TRUE,否则返回 FALSE。

实例

实例

<?php $arr_site = array('Google', 'Codercto', 'Facebook'); if(is_array($arr_site)){ echo '变量 $arr_site 是一个数组'; } else { echo '变量 $arr_site 不是一个数组'; } ?>

输出结果为:

变量 $arr_site 是一个数组

点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html

查看所有标签

Essential PHP Security

Essential PHP Security

Chris Shiflett / O'Reilly Media / 2005-10-13 / USD 29.95

Being highly flexible in building dynamic, database-driven web applications makes the PHP programming language one of the most popular web development tools in use today. It also works beautifully wit......一起来看看 《Essential PHP Security》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具