9) /* if > 9, then we've got 1X, we're supposed to sum the digits, so second digit + 1, is equivalent to $t - 9 */ $t -= 9; $r += $t; $m = 3 - $m; } return 10 - ($r % 10); } function luhn_check(string $s) : bool { $l = strlen($s); $c = $s[$l-1]; $r = luhn(substr($s, 0, $l - 1)); return $r == $c; } ?>