public static function getISBN10CheckDigit($isbn)
    {
        $sum = 0;
        for ($x = 0; $x < strlen($isbn); $x++) {
            $sum += intval(substr($isbn, $x, 1)) * (1 + $x);
        }
        $checkdigit = $sum % 11;
        return $checkdigit == 10 ? 'X' : $checkdigit;
    }
public static function getISBN10CheckDigit($isbn)
    {
        $sum = 0;
        for ($x = 0; $x < strlen($isbn); $x++) {
            $sum += intval(substr($isbn, $x, 1)) * (1 + $x);
        }
        $checkdigit = $sum % 11;
        return $checkdigit == 10 ? 'X' : $checkdigit;
    }
public static function getISBN10CheckDigit ( $ isbn ) { $ sum = 0 ; for ( $ x = 0 ; $ x < strlen ( $ isbn ) ; $ x ++ ) { $ sum += intval ( substr ( $ isbn , $ x , 1 ) ) * ( 1 + $ x ) ; } $ checkdigit = $ sum % 11 ; return $ checkdigit == 10 ? 'X' : $ checkdigit ; }
Given the first 9 digits of an ISBN-10, generate the check digit.

@param string $isbn The first 9 digits of an ISBN-10.

@return string      The check digit.
Given the first 9 digits of an ISBN - 10 generate the check digit .