Re: SSN Validation Class

From: Date: Sat, 08 Jun 2002 15:14:34 +0000
Subject: Re: SSN Validation Class
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-6801@lists.php.net to get a copy of this message
Cool Brent, I've just commited it with some CS retouchs :-) BTW, I've extended a little the ssnGetHighGroups() method for accepting more flexible sources (for ex a locally mirrored file or directly the contents if come from a cache handling system). I was thinking more in the integration with the multiple method, and it's very possible that I change the class definition to Validate_ISO instead of ValidateISO. So we could introduce an autoloader mechanism in multiple() with: $options = array( 'ssn' => array('type' => 'us_ssn', ..) ) // $val_method in the form "<class name><underscore><method name>" if (strpos('_', $val_method) !== false) { list($class, $method) = explode('_', $val_method); include_once "Validate/$class.php"; call_user_func(array("Validate_$class", $method), $args)); } Will take a look. Tomas V.V.Cox PS.- Thanks for the package.xml file :-) Brent Cook wrote: > > Okee dokey, > > This is the validation class for SSNs. This is how it might be used: > > include 'Validate/US.php'; > $test_numbers = array > ('123-23-2313','463911234','123-45-6789', > > '000-11-1111','111-00-1231','123-03-3434', > '999-12-3452', '743-99-2311'); > > $ssn_high_groups = ValidateUS::ssnGetHighGroups(); > > foreach ($test_numbers as $number) { > echo $number.' is '; > if (ValidateUS::ssn($number, $ssn_high_groups)) > echo "Valid\n"; > else > echo "Invalid\n"; > } > > It is intended to be placed where Tomas indicated, in Validation. Enjoy. > You can use it without passing the list of high ssn group numbers, but it > then pulls that data every time from the SSA webpage. > > - Brent > > ------------------------------------------------------------------------ > Name: US.php > US.php Type: Plain Text (TEXT/PLAIN) > Encoding: BASE64 > > Name: package.xml > package.xml Type: Plain Text (TEXT/PLAIN) > Encoding: BASE64

« previous php.pear.dev (#6801) next »