bool Validate_FI::creditCard
(
string $number
)
Validate credit card number.
This method checks the credit card number according to Luhn algorithm. This method doesn't guarantee that the card is legitimate.
credit card number to be validated (spaces and dashes tolerated)
boolean - true if credit card number is valid, false otherwise
Using creditCard()
<?php
// Include the package
require_once 'Validate/FI.php';
$creditCard = '5427 0073 1297 6425';
if ( Validate_FI::creditCard($creditCard) ) {
print 'Valid';
} else {
print 'Not valid!';
}
?>