public static function contains(array $data, array $needle)
    {
        if (empty($data) || empty($needle)) {
            return false;
        }
        $stack = [];

        while (!empty($needle)) {
            $key = key($needle);
            $val = $needle[$key];
            unset($needle[$key]);

            if (array_key_exists($key, $data) && is_array($val)) {
                $next = $data[$key];
                unset($data[$key]);

                if (!empty($val)) {
                    $stack[] = [$val, $next];
                }
            } elseif (!array_key_exists($key, $data) || $data[$key] != $val) {
                return false;
            }

            if (empty($needle) && !empty($stack)) {
                list($needle, $data) = array_pop($stack);
            }
        }

        return true;
    }
public static function contains(array $data, array $needle)
    {
        if (empty($data) || empty($needle)) {
            return false;
        }
        $stack = [];

        while (!empty($needle)) {
            $key = key($needle);
            $val = $needle[$key];
            unset($needle[$key]);

            if (array_key_exists($key, $data) && is_array($val)) {
                $next = $data[$key];
                unset($data[$key]);

                if (!empty($val)) {
                    $stack[] = [$val, $next];
                }
            } elseif (!array_key_exists($key, $data) || $data[$key] != $val) {
                return false;
            }

            if (empty($needle) && !empty($stack)) {
                list($needle, $data) = array_pop($stack);
            }
        }

        return true;
    }
public static function contains ( array $ data , array $ needle ) { if ( empty ( $ data ) || empty ( $ needle ) ) { return false ; } $ stack = [ ] ; while ( ! empty ( $ needle ) ) { $ key = key ( $ needle ) ; $ val = $ needle [ $ key ] ; unset ( $ needle [ $ key ] ) ; if ( array_key_exists ( $ key , $ data ) && is_array ( $ val ) ) { $ next = $ data [ $ key ] ; unset ( $ data [ $ key ] ) ; if ( ! empty ( $ val ) ) { $ stack [ ] = [ $ val , $ next ] ; } } elseif ( ! array_key_exists ( $ key , $ data ) || $ data [ $ key ] != $ val ) { return false ; } if ( empty ( $ needle ) && ! empty ( $ stack ) ) { list ( $ needle , $ data ) = array_pop ( $ stack ) ; } } return true ; }
Determines if one array contains the exact keys and values of another.

@param array $data The data to search through.
@param array $needle The values to file in $data
@return bool true If $data contains $needle, false otherwise
@link https://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::contains
Determines if one array contains the exact keys and values of another .