Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

is_array()

Check whether a container is a native PHP array.

Version: PHP 8.4; repository runtime, production runtime not attested

Syntax

is_array(mixed $value): bool

Check whether a container is a native PHP array. Both an empty list and an associative map pass. An ArrayObject can be indexed and iterated, but it remains an object and fails this check.

Signature

is_array(mixed $value): bool

Example output

[true,true,false]

Examples

<?php
echo json_encode([is_array([]), is_array(["x"=>1]), is_array(new ArrayObject([1]))]);

Result

[true,true,false]

Sources