Str.php
public static function matches(string $str, string $pattern) : bool
    {
        if ($pattern === $str) {
            return true;
        }

        return (bool) preg_match('#^'.str_replace('\*', '.*', preg_quote($pattern, '#')).'\z'.'#', $str);
    }
public static function matches(string $str, string $pattern) : bool
    {
        if ($pattern === $str) {
            return true;
        }

        return (bool) preg_match('#^'.str_replace('\*', '.*', preg_quote($pattern, '#')).'\z'.'#', $str);
    }
public static function matches ( string $ str , string $ pattern ) : bool { if ( $ pattern === $ str ) { return true ; } return ( bool ) preg_match ( '#^' . str_replace ( '\*' , '.*' , preg_quote ( $ pattern , '#' ) ) . '\z' . '#' , $ str ) ; }
Determines whether the given string matches the given pattern. Asterisks are translated into zero or more
regexp wildcards, allowing for glob-style patterns.

@param   string  $str        The string to match.
@param   string  $pattern    The pattern to match the string against.
@return  bool
Determines whether the given string matches the given pattern . Asterisks are translated into zero or more regexp wildcards allowing for glob - style patterns .