Dainius Vaičiulis Dainius Vaičiulis - 2 years ago 103
PHP Question

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

Is there any elegant way to check if

has any

Answer Source

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'])) { ... }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download