public static function has($array, $keys, $wildcard = null)
    {
        // If the keys are null or the array is not accessible
        if (null === $keys || empty($array) || !Arr::accessible($array)) {
            return false;
        }

        // Check that every key exists in $array
        $originalArray = $array;
        foreach ((array) $keys as $key) {
            $array = $originalArray;

            // If the array has the key carry on
            if (Arr::exists($array, $key)) {
                continue;
            }

            // Break up the key into segments and drill into the array
            $segments = explode('.', $key);
            foreach ($segments as $k => $segment) {
                // If the segment is a wildcard
                if ($segment === $wildcard && !empty($array)) {
                    // If this is the last segment then the array has the key
                    if ($k + 1 === count($segments)) {
                        break;
                    }
                    // If we are still considering an array, drill into every possibility
                    if (Arr::accessible($array)) {
                        // Check that at least one possibility contains the (sub)key
                        $subKey = implode('.', array_slice($segments, $k + 1));
                        $found  = array_reduce($array, function ($f, $item) use ($subKey, $wildcard) {
                            return $f || static::has($item, $subKey, $wildcard);
                        }, false);
                        if (!$found) {
                            return false;
                        } else {
                            break;
                        }
                    }
                }
                // Otherwise continue to drill into $array
                if (!empty($array) && Arr::accessible($array) && Arr::exists($array, $segment)) {
                    $array = $array[$segment];
                    continue;
                }
                return false;
            }
        }

        return true;
    }
public static function has($array, $keys, $wildcard = null)
    {
        // If the keys are null or the array is not accessible
        if (null === $keys || empty($array) || !Arr::accessible($array)) {
            return false;
        }

        // Check that every key exists in $array
        $originalArray = $array;
        foreach ((array) $keys as $key) {
            $array = $originalArray;

            // If the array has the key carry on
            if (Arr::exists($array, $key)) {
                continue;
            }

            // Break up the key into segments and drill into the array
            $segments = explode('.', $key);
            foreach ($segments as $k => $segment) {
                // If the segment is a wildcard
                if ($segment === $wildcard && !empty($array)) {
                    // If this is the last segment then the array has the key
                    if ($k + 1 === count($segments)) {
                        break;
                    }
                    // If we are still considering an array, drill into every possibility
                    if (Arr::accessible($array)) {
                        // Check that at least one possibility contains the (sub)key
                        $subKey = implode('.', array_slice($segments, $k + 1));
                        $found  = array_reduce($array, function ($f, $item) use ($subKey, $wildcard) {
                            return $f || static::has($item, $subKey, $wildcard);
                        }, false);
                        if (!$found) {
                            return false;
                        } else {
                            break;
                        }
                    }
                }
                // Otherwise continue to drill into $array
                if (!empty($array) && Arr::accessible($array) && Arr::exists($array, $segment)) {
                    $array = $array[$segment];
                    continue;
                }
                return false;
            }
        }

        return true;
    }
public static function has ( $ array , $ keys , $ wildcard = null ) { // If the keys are null or the array is not accessible if ( null === $ keys || empty ( $ array ) || ! Arr :: accessible ( $ array ) ) { return false ; } // Check that every key exists in $array $ originalArray = $ array ; foreach ( ( array ) $ keys as $ key ) { $ array = $ originalArray ; // If the array has the key carry on if ( Arr :: exists ( $ array , $ key ) ) { continue ; } // Break up the key into segments and drill into the array $ segments = explode ( '.' , $ key ) ; foreach ( $ segments as $ k => $ segment ) { // If the segment is a wildcard if ( $ segment === $ wildcard && ! empty ( $ array ) ) { // If this is the last segment then the array has the key if ( $ k + 1 === count ( $ segments ) ) { break ; } // If we are still considering an array, drill into every possibility if ( Arr :: accessible ( $ array ) ) { // Check that at least one possibility contains the (sub)key $ subKey = implode ( '.' , array_slice ( $ segments , $ k + 1 ) ) ; $ found = array_reduce ( $ array , function ( $ f , $ item ) use ( $ subKey , $ wildcard ) { return $ f || static :: has ( $ item , $ subKey , $ wildcard ) ; } , false ) ; if ( ! $ found ) { return false ; } else { break ; } } } // Otherwise continue to drill into $array if ( ! empty ( $ array ) && Arr :: accessible ( $ array ) && Arr :: exists ( $ array , $ segment ) ) { $ array = $ array [ $ segment ] ; continue ; } return false ; } } return true ; }
Determine if an item or items exist in an multi-dimensional associative array using "dots" notation.

@param ArrayAccess|array $array
@param string|string[]   $keys
@param null|string       $wildcard

@return bool
Determine if an item or items exist in an multi - dimensional associative array using dots notation .