PHP code example of seb-c / alpha-increment

1. Go to this page and download the library: Download seb-c/alpha-increment 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/ */

    

seb-c / alpha-increment example snippets


$ai = new AlphaIncrement();
echo $ai->encode(1); // prints "TKSAC"
echo $ai->encode(2); // prints "TKSAD"
echo $ai->encode(3); // prints "TKSAZ"
echo $ai->encode(42); // prints "TKSKY"
echo $ai->encode(314); // prints "TKSGB"
echo $ai->encode(7654321); // prints "9JXCC"

$ai = new AlphaIncrement(4, '😀😃😉😋😎😴😕😓😞😇', false);
echo $ai->encode(1); // prints "😋😞😉😴"
echo $ai->encode(2); // prints "😋😞😉😕"
echo $ai->encode(3); // prints "😋😞😉😓"
echo $ai->encode(42); // prints "😋😞😉😞"
echo $ai->encode(314); // prints "😋😞😉😇"
echo $ai->encode(654321); // prints "😋😞😉😀"

$ai = new AlphaIncrement(3);
echo $ai->encode(10); // returns "SAT"
echo $ai->encode(42); // returns "SKY"
echo $ai->encode(7654321); // returns "9JXCC"
echo $ai->encode(PHP_INT_MAX); // returns "1UL1RDNFPP5OW"