choval/damm
最新稳定版本:v0.1.1
Composer 安装命令:
composer require choval/damm
包简介
Damm algorithm functions, a check digit algorithm that detects single-digit errors and adjacent transposition errors
README 文档
README
Damm algorithm functions.
In error detection, the Damm algorithm is a check digit algorithm that detects all single-digit errors and adjacent transposition errors. It was presented by H. Michael Damm in 2004.
-- Wikipedia
Install
composer require choval/damm
Usage
damm_digit(string $number) : int damm_valid(string $number[, string $digit]) : bool
Both functions take a string as parameter to allow numbers larger than PHP_INT_MAX.
They still have to be numeric.
Examples:
echo damm_digit(572); // 4 echo damm_digit('572'); // 4 echo damm_digit('0000572'); // 4 echo damm_valid(572, 4); // true echo damm_valid(572, 3); // false echo damm_valid(5724); // true echo damm_valid('000005724'); // true
License
MIT, see LICENSE
统计信息
- 总下载量: 1.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-16