English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP is_array() function usage and example

PHP available functions

is_array() The function is used to check if a variable is an array.

PHP version requirement: PHP 4, PHP 5, PHP 7

Syntax

bool is_array ( mixed $var )

Parameter description:

  • $var: The variable to be checked.

Return value

If the detected variable is an array, it returns TRUE, otherwise it returns FALSE.

Online example

<?php
$arr_site = array('Google', 'w3codebox', '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:

The variable $arr_site is an array

PHP available functions