PHP code example of kwaadpepper / serial-int-caster

1. Go to this page and download the library: Download kwaadpepper/serial-int-caster 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/ */

    

kwaadpepper / serial-int-caster example snippets

 PHP
$int_to_encode = 15;
$dictionnary = 'ABCDEFabcdef0123456789';
$seed = 1492;
/** @var string $encoded_number ('1bzzzO') */
$encoded_number = SerialCaster::encode(number: $int_to_encode, seed: $seed, length: 6, chars: $dictionnary);

/** @var integer $decoded_number (15) */
$decoded_number = SerialCaster::decode(serial: '1bzzzO', seed: $seed, chars: $dictionnary);

/** Prints TRUE */
print_r($int_to_encode === $decoded_number);