class Luhn

Utility class for generating and validating Luhn numbers.

Luhn algorithm is used to validate credit card numbers, IMEI numbers, and National Provider Identifier numbers.

Methods

static  string
computeCheckDigit($partialNumber)

No description

static  bool
isValid( string $number)

Checks whether a number (partial number + check digit) is Luhn compliant

static  string
generateLuhnNumber( string $partialValue)

Generate a Luhn compliant number.

Details

static string computeCheckDigit($partialNumber)

Parameters

$partialNumber

Return Value

string

static bool isValid( string $number)

Checks whether a number (partial number + check digit) is Luhn compliant

Parameters

string $number

Return Value

bool

static string generateLuhnNumber( string $partialValue)

Generate a Luhn compliant number.

Parameters

string $partialValue

Return Value

string