public static function has($array, $key, $delimiter = '.')
    {
        $nodes = static::getPathNodes($key, $delimiter);

        if (empty($nodes)) {
            return false;
        }

        $dataTmp = $array;

        foreach ($nodes as $arg) {
            if (is_object($dataTmp) && property_exists($dataTmp, $arg)) {
                // Check object value exists
                $dataTmp = $dataTmp->$arg;
            } elseif ($dataTmp instanceof \ArrayAccess && isset($dataTmp[$arg])) {
                // Check arrayAccess value exists
                $dataTmp = $dataTmp[$arg];
            } elseif (is_array($dataTmp) && array_key_exists($arg, $dataTmp)) {
                // Check object value exists
                $dataTmp = $dataTmp[$arg];
            } else {
                return false;
            }
        }

        return true;
    }
public static function has($array, $key, $delimiter = '.')
    {
        $nodes = static::getPathNodes($key, $delimiter);

        if (empty($nodes)) {
            return false;
        }

        $dataTmp = $array;

        foreach ($nodes as $arg) {
            if (is_object($dataTmp) && property_exists($dataTmp, $arg)) {
                // Check object value exists
                $dataTmp = $dataTmp->$arg;
            } elseif ($dataTmp instanceof \ArrayAccess && isset($dataTmp[$arg])) {
                // Check arrayAccess value exists
                $dataTmp = $dataTmp[$arg];
            } elseif (is_array($dataTmp) && array_key_exists($arg, $dataTmp)) {
                // Check object value exists
                $dataTmp = $dataTmp[$arg];
            } else {
                return false;
            }
        }

        return true;
    }
public static function has ( $ array , $ key , $ delimiter = '.' ) { $ nodes = static :: getPathNodes ( $ key , $ delimiter ) ; if ( empty ( $ nodes ) ) { return false ; } $ dataTmp = $ array ; foreach ( $ nodes as $ arg ) { if ( is_object ( $ dataTmp ) && property_exists ( $ dataTmp , $ arg ) ) { // Check object value exists $ dataTmp = $ dataTmp -> $ arg ; } elseif ( $ dataTmp instanceof \ ArrayAccess && isset ( $ dataTmp [ $ arg ] ) ) { // Check arrayAccess value exists $ dataTmp = $ dataTmp [ $ arg ] ; } elseif ( is_array ( $ dataTmp ) && array_key_exists ( $ arg , $ dataTmp ) ) { // Check object value exists $ dataTmp = $ dataTmp [ $ arg ] ; } else { return false ; } } return true ; }
Check a key exists in object or array. The key can be a path separated by dots.

@param array|object $array     Object or array to check.
@param string       $key       The key path name.
@param string       $delimiter The separator to split paths.

@return  bool

@since 4.0
Check a key exists in object or array . The key can be a path separated by dots .