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

at line 40
static string computeCheckDigit($partialNumber)

No description

Parameters

$partialNumber

Return Value

string

at line 56
static bool isValid(string $number)

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

Parameters

string $number

Return Value

bool

at line 68
static string generateLuhnNumber(string $partialValue)

Generate a Luhn compliant number.

Parameters

string $partialValue

Return Value

string