PHP code example of sunaoka / damm

1. Go to this page and download the library: Download sunaoka/damm library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sunaoka / damm example snippets




use Sunaoka\Damm\Damm;
use Sunaoka\Damm\Order\Order10;

$damm = new Damm('0123456789', new Order10());

echo $damm->calculate('572');
// => 4

var_dump($damm->validate('5724'));
// => bool(true)



use Sunaoka\Damm\Damm;
use Sunaoka\Damm\Order\Order62;

$damm = new Damm('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', new Order62());

echo $damm->calculate('4MTYDKH0S0E');
// => D

var_dump($damm->validate('4MTYDKH0S0ED'));
// => bool(true)