source/Core/CreditCardValidator.php
protected function _isValidNumer($number)
    {
        $valid = false;
        if (($length = strlen($number))) {
            $modSum = 0;
            $mod = $length % 2;

            // Luhn algorithm
            for ($pos = 0; $pos < $length; $pos++) {
                // taking digit to check..
                $currDigit = ( int ) $number{$pos};

                // multiplying if needed..
                $addValue = (($pos % 2 == $mod) ? 2 : 1) * $currDigit;

                // adding prepared current digit
                $modSum += ($addValue > 9) ? $addValue - 9 : $addValue;
            }

            $valid = ($modSum % 10) == 0;
        }

        return $valid;
    }
protected function _isValidNumer($number)
    {
        $valid = false;
        if (($length = strlen($number))) {
            $modSum = 0;
            $mod = $length % 2;

            // Luhn algorithm
            for ($pos = 0; $pos < $length; $pos++) {
                // taking digit to check..
                $currDigit = ( int ) $number{$pos};

                // multiplying if needed..
                $addValue = (($pos % 2 == $mod) ? 2 : 1) * $currDigit;

                // adding prepared current digit
                $modSum += ($addValue > 9) ? $addValue - 9 : $addValue;
            }

            $valid = ($modSum % 10) == 0;
        }

        return $valid;
    }
protected function _isValidNumer ( $ number ) { $ valid = false ; if ( ( $ length = strlen ( $ number ) ) ) { $ modSum = 0 ; $ mod = $ length % 2 ; // Luhn algorithm for ( $ pos = 0 ; $ pos < $ length ; $ pos ++ ) { // taking digit to check.. $ currDigit = ( int ) $ number { $ pos } ; // multiplying if needed.. $ addValue = ( ( $ pos % 2 == $ mod ) ? 2 : 1 ) * $ currDigit ; // adding prepared current digit $ modSum += ( $ addValue > 9 ) ? $ addValue - 9 : $ addValue ; } $ valid = ( $ modSum % 10 ) == 0 ; } return $ valid ; }
checks credit card number. Returns TRUE if card number is valid

@param string $number credit card number

@return bool
checks credit card number . Returns TRUE if card number is valid