PHP code example of tuupola / base62
1. Go to this page and download the library: Download tuupola/base62 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/ */
tuupola / base62 example snippets
use Tuupola\Base62;
print Base62::GMP; /* 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz */
print Base62::INVERTED; /* 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ */
$default = new Base62(["characters" => Base62::GMP]);
$inverted = new Base62(["characters" => Base62::INVERTED]);
print $default->encode("Hello world!"); /* T8dgcjRGuYUueWht */
print $inverted->encode("Hello world!"); /* t8DGCJrgUyuUEwHT */
php
$base62 = new Tuupola\Base62;
$encoded = $base62->encode(random_bytes(128));
$decoded = $base62->decode($encoded);
php
$integer = $base62->encodeInteger(987654321); /* 14q60P */
print $base62->decodeInteger("14q60P"); /* 987654321 */
php
$string = $base62->encode("987654321"); /* KHc6iHtXW3iD */
$integer = $base62->encodeInteger(987654321); /* 14q60P */
php
use Tuupola\Base62Proxy as Base62;
$encoded = Base62::encode(random_bytes(128));
$decoded = Base62::decode($encoded);
$encoded2 = Base62::encodeInteger(987654321);
$decoded2 = Base62::decodeInteger($encoded2);