What potential pitfalls should be considered when using is_array() in PHP?

When using is_array() in PHP, it's important to consider that it will return true for arrays and false for other data types like objects or strings that might be mistakenly used as arrays. To avoid potential pitfalls, you can combine is_array() with other checks like is_array() && !empty() to ensure that the variable is not only an array but also not empty.

// Check if $myArray is an array and not empty
if (is_array($myArray) && !empty($myArray)) {
    // Proceed with using $myArray
} else {
    // Handle the case where $myArray is not a valid non-empty array
}