PHP is_array() Function

PHP 可用的函数PHP Available Functions

is_array()This function is used to detect whether a variable is an array.

PHP Version Requirements: PHP 4, PHP 5, PHP 7

Syntax

bool is_array ( mixed $var )

Parameter Description:

  • $var: The variable to be detected.

Return Value

Returns TRUE if the detected variable is an array, otherwise returns FALSE.

Example

Example

<?php $arr_site = array('Google', 'Example', 'Facebook'); if(is_array($arr_site)){ echo 'The variable $arr_site is an array'; } else { echo 'The variable $arr_site is not an array'; } ?>

The output result is:

变量 $arr_site 是一个数组

PHP 可用的函数PHP Available Functions

Other Extensions