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:
<?php $arr_age = array(18, 20, 25); if(is_array($arr_age)){ echo '变量 $arr_age 是一个数组'; } else { echo '变量 $arr_age 不是一个数组'; } ?>
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.