cvs: pear /Validate Validate.php

From: Date: Sun, 18 Aug 2002 19:08:06 +0000
Subject: cvs: pear /Validate Validate.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5795@lists.php.net to get a copy of this message
pajoye Sun Aug 18 15:08:06 2002 EDT Modified files: /pear/Validate Validate.php Log: Add _modf method to calc modulo with large numbers Make creditCard user friendly Index: pear/Validate/Validate.php diff -u pear/Validate/Validate.php:1.21 pear/Validate/Validate.php:1.22 --- pear/Validate/Validate.php:1.21 Thu Jun 13 18:39:25 2002 +++ pear/Validate/Validate.php Sun Aug 18 15:08:05 2002 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Validate.php,v 1.21 2002/06/13 22:39:25 pajoye Exp $ +// $Id: Validate.php,v 1.22 2002/08/18 19:08:05 pajoye Exp $ // // Methods for common data validations // @@ -148,6 +148,9 @@ if (is_array($number)) { extract($number); } + + $number = preg_replace('/[^0-9]/','',$number); + if (empty($number) || ($len_number = strlen($number)) <= 0) { return false; } @@ -299,6 +302,17 @@ return $ret; } + function _modf($val, $div) { + if( function_exists('bcmod') ){ + return bcmod($val,$div); + } else if (function_exists('fmod')) { + return fmod($val,$div); + } + $r = $a / $b; + $i = intval($r); + return intval(($r - $i) * $b); + } + /** * Bulk data validation for data introduced in the form of an * assoc array in the form $var_name => $value. @@ -349,4 +363,4 @@ return $valid; } } -?> +?> \ No newline at end of file

« previous php.pear.cvs (#5795) next »