Dainius Vaičiulis Dainius Vaičiulis - 5 months ago 19x
PHP Question

PHP - elegant way to check if assoc array value has a subarray?

Is there any elegant way to check if

has any


Try with is_array(). It will check if it is an array or not -

if(is_array($review['passenger'])) {
   // is an array

Or if you want to check if some key is present or not then -

if(array_key_exists('key', $review['passenger'])) { ... }