Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for phpPlatonLib/Credit_Card/Attic/Luhn_Check.php between version 1.3 and 1.4

version 1.3, 2002/03/31 20:56:31 version 1.4, 2002/05/22 10:51:12
Line 46  class Credit_Card_Luhn_Check
Line 46  class Credit_Card_Luhn_Check
          * Luhn check algorithm. It is published on several places,           * Luhn check algorithm. It is published on several places,
          * and also here:           * and also here:
          *           *
          *              http://hysteria.sk/prielom/prielom-12.html#3       *      http://www.webopedia.com/TERM/L/Luhn_formula.html
        *      http://www.merriampark.com/anatomycc.htm
            *              http://hysteria.sk/prielom/prielom-12.html#3 (Slovak language)
        *      http://www.speech.cs.cmu.edu/~sburke/pub/luhn_lib.html (Perl lib)
          *           *
          * @param  string $number       credit card number           * @param  string $number       credit card number
          * @return bool                 true if number is valid, otherwise false           * @return bool                 true if number is valid, otherwise false
Line 59  class Credit_Card_Luhn_Check
Line 62  class Credit_Card_Luhn_Check
                 $sum = 0;                  $sum = 0;
                 for ($k = $len_number % 2; $k < $len_number; $k += 2) {                  for ($k = $len_number % 2; $k < $len_number; $k += 2) {
   
                         if ((intval($number[$k]) * 2) > 9)                          if ((intval($number[$k]) * 2) > 9) {
                                 $sum += (intval($number[$k]) * 2) - 9;                                  $sum += (intval($number[$k]) * 2) - 9;
                         else              }
                           else {
                                 $sum += intval($number[$k]) * 2;                                  $sum += intval($number[$k]) * 2;
               }
                 }                  }
   
                 for ($k = ($len_number % 2) ^ 1; $k < $len_number; $k += 2) {                  for ($k = ($len_number % 2) ^ 1; $k < $len_number; $k += 2) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top