public static function validate($checkType, $value)
    {
        if (array_key_exists($checkType, self::$checks)) {
            if (empty(self::$checks[$checkType])) {
                $blnReturn = true;
            } else {
                if (is_array($value)) {
                    $arrValues = $value;
                    $blnSub = true;
                    foreach ($arrValues as $value) {
                        $blnSub = preg_match(self::$checks[$checkType], $value);
                        if (! $blnSub) {
                            // *** At least 1 value is not valid, skip the rest and return false;
                            exit();
                        }
                    }

                    $blnReturn = $blnSub;
                } else {
                    $blnReturn = preg_match(self::$checks[$checkType], $value);
                }
            }
        } else {
            if (empty($checkType)) {
                $blnReturn = true; // No custom validation set.
            } else {
                $blnReturn = @preg_match($checkType, $value); // Use custom validation
            }
        }

        return $blnReturn;
    }
public static function validate($checkType, $value)
    {
        if (array_key_exists($checkType, self::$checks)) {
            if (empty(self::$checks[$checkType])) {
                $blnReturn = true;
            } else {
                if (is_array($value)) {
                    $arrValues = $value;
                    $blnSub = true;
                    foreach ($arrValues as $value) {
                        $blnSub = preg_match(self::$checks[$checkType], $value);
                        if (! $blnSub) {
                            // *** At least 1 value is not valid, skip the rest and return false;
                            exit();
                        }
                    }

                    $blnReturn = $blnSub;
                } else {
                    $blnReturn = preg_match(self::$checks[$checkType], $value);
                }
            }
        } else {
            if (empty($checkType)) {
                $blnReturn = true; // No custom validation set.
            } else {
                $blnReturn = @preg_match($checkType, $value); // Use custom validation
            }
        }

        return $blnReturn;
    }
public static function validate ( $ checkType , $ value ) { if ( array_key_exists ( $ checkType , self :: $ checks ) ) { if ( empty ( self :: $ checks [ $ checkType ] ) ) { $ blnReturn = true ; } else { if ( is_array ( $ value ) ) { $ arrValues = $ value ; $ blnSub = true ; foreach ( $ arrValues as $ value ) { $ blnSub = preg_match ( self :: $ checks [ $ checkType ] , $ value ) ; if ( ! $ blnSub ) { // *** At least 1 value is not valid, skip the rest and return false; exit ( ) ; } } $ blnReturn = $ blnSub ; } else { $ blnReturn = preg_match ( self :: $ checks [ $ checkType ] , $ value ) ; } } } else { if ( empty ( $ checkType ) ) { $ blnReturn = true ; // No custom validation set. } else { $ blnReturn = @ preg_match ( $ checkType , $ value ) ; // Use custom validation } } return $ blnReturn ; }
Validate input against regular expression

@param integer $checkType The type to check for
@param string $value The value to validate
@return boolean True if valid, false if not.
Validate input against regular expression