PHP code example of reshadman / bijective-shortener
1. Go to this page and download the library: Download reshadman/bijective-shortener 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/ */
reshadman / bijective-shortener example snippets
use \Reshadman\BijectiveShortener\BijectiveShortener;
BijectiveShortener::setChars(
'YRCAtS2qcL06JzFeWIsf9HbwgVPUoOkrZpaGm47vjNEuMT1dynlDxXhQK8i5B3'
);
$shortened = BijectiveShortener::makeFromInteger($int = 60500);
$decoded = BijectiveShortener::decodeToInteger($shortened);
echo 'The Shortened version of ' . $int ' is' . $shortened '\n';
echo 'The decoded version of ' . $shortened ' is ' . $decoded ' which is equal to original number(' . $int ')';