Example 1 — Checking Different Values
Test an array and three non-array values.
<?php
var_dump(is_array([1, 2, 3]));
var_dump(is_array("text"));
var_dump(is_array(5));
var_dump(is_array(null)); How It Works
- [1, 2, 3] is an array, so the first call returns true.
- A string, even if it contains list-like text, is not an array.
- A number is not an array.
- null is not an array either.

