$type) { if(!isset($var[$name])) { return "Undefined member {$name}"; } else { switch($type) { case (Regex::TYPE_NUMBER): $valid = Regex::isNumber($var[$name]); break; case (Regex::TYPE_USERNAME): $valid = Regex::isUserName($var[$name]); break; case (Regex::TYPE_EMAIL): $valid = Regex::isEmail($var[$name]); break; case (Regex::TYPE_PROXYNAME): $valid = Regex::isProxyName($var[$name]); break; case (Regex::TYPE_DOMAIN): $valid = Regex::isDomain($var[$name]); break; case (Regex::TYPE_LETTER): $valid = Regex::isLetter($var[$name]); break; case (Regex::TYPE_NOTEMPTY): $valid = (!empty($var[$name])); break; case (Regex::TYPE_IPV4): $valid = Regex::isIpv4($var[$name]); break; case (Regex::TYPE_IPV6): $valid = Regex::isIpv6($var[$name]); break; case (Regex::TYPE_IPV4_V6): $valid = (Regex::isIpv4($var[$name]) || Regex::isIpv6($var[$name])); break; case (Regex::TYPE_HOSTNAME): $valid = Regex::isHostName($var[$name]); break; default: return "Undefined type {$type}"; } if(!$valid) { return "Not valid {$name}"; } } } return $valid; } }