public static function validateLuhn($number)
    {
        $str = '';
        foreach (array_reverse(str_split($number)) as $i => $c) {
            $str .= $i % 2 ? $c * 2 : $c;
        }

        return array_sum(str_split($str)) % 10 === 0;
    }
public static function validateLuhn($number)
    {
        $str = '';
        foreach (array_reverse(str_split($number)) as $i => $c) {
            $str .= $i % 2 ? $c * 2 : $c;
        }

        return array_sum(str_split($str)) % 10 === 0;
    }
public static function validateLuhn ( $ number ) { $ str = '' ; foreach ( array_reverse ( str_split ( $ number ) ) as $ i => $ c ) { $ str .= $ i % 2 ? $ c * 2 : $ c ; } return array_sum ( str_split ( $ str ) ) % 10 === 0 ; }
Validate a card number according to the Luhn algorithm.

@param  string  $number The card number to validate
@return boolean True if the supplied card number is valid
Validate a card number according to the Luhn algorithm .