Page History
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
public function isCdvCorrect() { return $this->calculateCdv() == $this->cdv; } public function calculateCdv() { $sum = 0; $j = 1; $valueAsString = (string) $this->value; for ($i = $this->getValueLength() - 1; $i > -1; $i--) { if ($j % 2 != 0) { $result = $valueAsString[$i] * 2; } else { $result = $valueAsString[$i]; } foreach(str_split($result) as $digit) { $sum += $digit; } $j++; } return $sum % 10; } |
...
Overview
Content Tools