if ($isSecond) $digit *= 2; if ($digit > 9) $digit -= 9;
From the rightmost digit (excluding the check digit), double the value of every second digit. If doubling results in a number > 9, subtract 9 from it. Sum all the digits. cc checker script php best