public function ccnum($message = null)
    {
        $this->setRule(__FUNCTION__, function($value)
                       {
                           $value = str_replace(' ', '', $value);
                           $length = strlen($value);

                           if ($length < 13 || $length > 19) {
                               return FALSE;
                           }

                           $sum = 0;
                           $weight = 2;

                           for ($i = $length - 2; $i >= 0; $i--) {
                               $digit = $weight * $value[$i];
                               $sum += floor($digit / 10) + $digit % 10;
                               $weight = $weight % 2 + 1;
                           }

                           $mod = (10 - $sum % 10) % 10;

                           return ($mod == $value[$length - 1]);
                       }, $message);
        return $this;
    }
public function ccnum($message = null)
    {
        $this->setRule(__FUNCTION__, function($value)
                       {
                           $value = str_replace(' ', '', $value);
                           $length = strlen($value);

                           if ($length < 13 || $length > 19) {
                               return FALSE;
                           }

                           $sum = 0;
                           $weight = 2;

                           for ($i = $length - 2; $i >= 0; $i--) {
                               $digit = $weight * $value[$i];
                               $sum += floor($digit / 10) + $digit % 10;
                               $weight = $weight % 2 + 1;
                           }

                           $mod = (10 - $sum % 10) % 10;

                           return ($mod == $value[$length - 1]);
                       }, $message);
        return $this;
    }
public function ccnum ( $ message = null ) { $ this -> setRule ( __FUNCTION__ , function ( $ value ) { $ value = str_replace ( ' ' , '' , $ value ) ; $ length = strlen ( $ value ) ; if ( $ length < 13 || $ length > 19 ) { return FALSE ; } $ sum = 0 ; $ weight = 2 ; for ( $ i = $ length - 2 ; $ i >= 0 ; $ i -- ) { $ digit = $ weight * $ value [ $ i ] ; $ sum += floor ( $ digit / 10 ) + $ digit % 10 ; $ weight = $ weight % 2 + 1 ; } $ mod = ( 10 - $ sum % 10 ) % 10 ; return ( $ mod == $ value [ $ length - 1 ] ) ; } , $ message ) ; return $ this ; }
Field has to be a valid credit card number format.

@see https://github.com/funkatron/inspekt/blob/master/Inspekt.php
@param string $message
@return FormValidator
Field has to be a valid credit card number format .