In PHP7+ to find if a value is set in a multidimensional array with a fixed number of dimensions, simply use the Null Coalescing Operator: ?? So for a three dimensional array where you are not sure about any of the keys actually existing <?php // instead of: $exists = array_key_exists($key1, $arr) && array_key_exists($key2, $arr[$key1]) && array_key_exists($key3, $arr[$key1][$key2]) ; // use: $exists = array_key_exists($key3, $arr[$key1][$key2]??[]) ; ?>