Home > php教程 > php手册 > body text

PHP is_array() implementation method to detect whether a variable is an array, is_array array

WBOY
Release: 2016-07-06 14:24:38
Original
1090 people have browsed it

PHP is_array() implementation method to detect whether a variable is an array, is_array array

is_array()

PHP is_array() function is used to detect whether a variable is an array. This function is especially used for some security checks (such as form or SESSION checks, etc.).

Grammar:

bool is_array (mixed var) Returns TRUE if var is an array, otherwise returns FALSE.

Example:

<&#63;php
$arr_age = array(18, 20, 25);
if(is_array($arr_age)){
  echo '变量 $arr_age 是一个数组';
} else {
  echo '变量 $arr_age 不是一个数组';
}
&#63;>
Copy after login

Run this example output:

The variable $arr_age is an array

The above implementation method of PHP is_array() to detect whether a variable is an array is all the content shared by the editor. I hope it can give you a reference, and I also hope that everyone will support Bangkejia.

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template