GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - choval/damm: Damm algorithm functions, a check digit algorithm that detects single-digit errors and adjacent transposition errors

BranchesTags
Open more actions menu

Latest commit

 

History

7 Commits
7 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
composer.lock
composer.lock
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 
runtests
runtests
 
 

Repository files navigation

Choval/damm

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

About

Damm algorithm functions, a check digit algorithm that detects single-digit errors and adjacent transposition errors

Topics

check-digitcheckdigitdammdamm-algorithmphp

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.