PHP code example of lenny4 / compress-int

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

    

lenny4 / compress-int example snippets


$number = 123456;
$compress = Lenny4\CompressInt::compress($number); // e7w
$decompress = Lenny4\CompressInt::decompress($compress); // 123456

$number = 123456;
$customSymbols = '0123456789abcdefghijklmnopqrstuvwxyz'
$compress = Lenny4\CompressInt::compress($number, $customSymbols);
$decompress = Lenny4\CompressInt::decompress($compress, $customSymbols);

Lenny4\CompressInt::DEFAULT_SYMBOLS // 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
Lenny4\CompressInt::LONG_SYMBOLS // 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&()*+,-/:;<=>?@[\]^_{|}~
Lenny4\CompressInt::DEFAULT_SYMBOLS_INSENSITIVE // 0123456789abcdefghijklmnopqrstuvwxyz
Lenny4\CompressInt::LONG_SYMBOLS_INSENSITIVE // 0123456789abcdefghijklmnopqrstuvwxyz!#$%&()*+,-/:;<=>?@[\]^_{|}~