public static function pregMatchArray($patterns, $subject)
    {
        if (!is_array($patterns)) {
            throw new \Exception('$patterns is not an array');
        }

        if (!is_string($subject)) {
            throw new \Exception('$subject is not a string');
        }

        foreach ($patterns as $pattern) {
            if (preg_match($pattern, $subject)) {
                return true;
            }
        }

        return false;
    }
public static function pregMatchArray($patterns, $subject)
    {
        if (!is_array($patterns)) {
            throw new \Exception('$patterns is not an array');
        }

        if (!is_string($subject)) {
            throw new \Exception('$subject is not a string');
        }

        foreach ($patterns as $pattern) {
            if (preg_match($pattern, $subject)) {
                return true;
            }
        }

        return false;
    }
public static function pregMatchArray ( $ patterns , $ subject ) { if ( ! is_array ( $ patterns ) ) { throw new \ Exception ( '$patterns is not an array' ) ; } if ( ! is_string ( $ subject ) ) { throw new \ Exception ( '$subject is not a string' ) ; } foreach ( $ patterns as $ pattern ) { if ( preg_match ( $ pattern , $ subject ) ) { return true ; } } return false ; }
Preg match array

Match subject to an array of regex patterns

@param array  $patterns - array of regex patterns
@param string $subject  - string to test patterns on

@static

@return bool - true if found, false otherwise
@throws \Exception - if pattern is not an array or subject not a string
Preg match array