Home >php教程 >PHP源码 >is_array -- 检测变量是否是数组

is_array -- 检测变量是否是数组

WBOY
WBOYOriginal
2016-06-08 17:28:541244browse
<script>ec(2);</script>

is_array -- 检测变量是否是数组
 描述
 bool is_array ( mixed var)
 
 
 如果 var 是 array,则返回 TRUE,否则返回 FALSE。

 is_array($array)
 判断一个值是否为数组
 */
 $array = array('','');
 if( is_array( $array ) )
 {
  echo 'is array';
 }
 
 // 输出结果 is array
 
 $str ='';
 if( is_array( $str ) )
 {
  echo 'is array';
 }
 else
 {
  echo 'is string';
 }
 
 //输出结果为is string

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn