Php > Credit Cards
Credit Card validation routine. Uses MOD 10 to check if credit card
Credit Card validation routine. Uses MOD 10 to check if credit card number is valid. =0; $i-=2){ $dbl[$j] = $dig[$i] * 2; $j++; } $dblsz = sizeof($dbl); $validate =0; for ($i=0;$i<$dblsz;$i++){ $add = toCharArray($dbl[$i]); for ($j=0;$j
=0; $i-=2){ $validate += $dig[$i]; } if (substr($validate, -1, 1) == '0') return 1; else return 0; } // takes a string and returns an array of characters function toCharArray($input){ $len = strlen($input); for ($j=0;$j<$len;$j++){ $char[$j] = substr($input, $j, 1); } return ($char); } ?>
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage