public static function validateString($string, $rule)
    {
        if (!is_array($rule) && ($rule == '' || $rule == null)) {
            return true;
        }

        if (!is_array($string) && ($string == '' || $rule == null)) {
            return true;
        }

        if (!is_array($rule)) {
            $rule = array($rule);
        }

        if (!is_array($string)) {
            $string = array($string);
        }

        foreach ($rule as $r) {
            foreach ($string as $s) {
                if (!preg_match($r, $s)) {
                    return false;
                }
            }
        }
        return true;
    }