public function patternMatch($pattern, $string) { return preg_match('#^' . strtr(preg_quote($pattern, '#'), ['\\*' => '.*', '\\?' => '.']) . '$#i', $string); }