function isbn_check_10 in ISBN Field 6.0
Same name and namespace in other branches
- 7 isbn.module \isbn_check_10()
2 calls to isbn_check_10()
File
- ./
isbn.module, line 145 - Maintains a consistant relationship between nodes and ISBNs.
Code
function isbn_check_10($isbn) {
for ($i = 0; $i < 9; $i++) {
$digit = substr($isbn, $i, 1);
$total = $total + $digit * (10 - $i);
}
$remainder = $total % 11;
$check = 11 - $remainder;
if ($check == 10) {
$check = 'X';
}
elseif ($check == 11) {
$check = 0;
}
return $check;
}