in reply to Re: Elfproef (Dutch bank account check)
in thread Elfproef (Dutch bank account check)

Because you have to multiply the last number by 1, the second to last by 2, etc.
$sum += (substr($account, $_-1, 1) * $_);
multiplies the first by 1, the second by 2 (the wrong way around :)

Replies are listed 'Best First'.
Re: Re: Re: Elfproef (Dutch bank account check)
by petral (Curate) on Jul 29, 2001 at 00:48 UTC
    Oh, right.  I guess the only simplification would be
    $sum += substr($account, -$_, 1) * $_;
    Anyway, good code.

      p