cvs: pear /Validate Validate.php

From: Date: Mon, 17 Feb 2003 15:19:14 +0000
Subject: cvs: pear /Validate Validate.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8914@lists.php.net to get a copy of this message
pajoye Mon Feb 17 10:19:14 2003 EDT Modified files: /pear/Validate Validate.php Log: Rename creditcard to creditCard Fix nth char access using {} instead of [] Index: pear/Validate/Validate.php diff -u pear/Validate/Validate.php:1.27 pear/Validate/Validate.php:1.28 --- pear/Validate/Validate.php:1.27 Mon Feb 17 05:55:14 2003 +++ pear/Validate/Validate.php Mon Feb 17 10:19:14 2003 @@ -17,7 +17,7 @@ // | Pierre-Alain Joye <pajoye@phpindex.com> | // +----------------------------------------------------------------------+ // -// $Id: Validate.php,v 1.27 2003/02/17 10:55:14 mansion Exp $ +// $Id: Validate.php,v 1.28 2003/02/17 15:19:14 pajoye Exp $ // // Methods for common data validations // @@ -167,23 +167,23 @@ * @return bool true if number is valid, otherwise false * @author Ondrej Jombik <nepto@pobox.sk> */ - function creditcard($creditcard) + function creditCard($creditCard) { - $creditcard = preg_replace('/[^0-9]/','',$creditcard); + $creditCard = preg_replace('/[^0-9]/','',$creditCard); - if (empty($creditcard) || ($len_number = strlen($creditcard)) <= 0) { + if (empty($creditCard) || ($len_number = strlen($creditCard)) <= 0) { return false; } $sum = 0; for ($k = $len_number % 2; $k < $len_number; $k += 2) { - if ((intval($creditcard[$k]) * 2) > 9) { - $sum += (intval($creditcard[$k]) * 2) - 9; + if ((intval($creditCard{$k}) * 2) > 9) { + $sum += (intval($creditCard{$k}) * 2) - 9; } else { - $sum += intval($creditcard[$k]) * 2; + $sum += intval($creditCard{$k}) * 2; } } for ($k = ($len_number % 2) ^ 1; $k < $len_number; $k += 2) { - $sum += intval($creditcard[$k]); + $sum += intval($creditCard{$k}); } return $sum % 10 ? false : true; } @@ -439,4 +439,4 @@ return $valid; } } -?> \ No newline at end of file +?>

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