Format credit card number

后端 未结 10 2249
梦谈多话
梦谈多话 2020-12-08 11:27

How to format and validate a credit card number with spaces between each 4 digit while typing:

eg: 4464 6846 4354 3564

I have tried:

10条回答
  •  醉话见心
    2020-12-08 12:19

     9) {
            $digit-=9;
          }
        }
        // Total up the digits
        $total+=$digit;
      }
    
      // If the total mod 10 equals 0, the number is valid
      return ($total % 10 == 0) ? TRUE : FALSE;
    
    }
    ?>
    

提交回复
热议问题