PHP Requires Chilkat v11.2.0+
Chilkat2 PHP
Base62 Encoding and Decoding
Demonstrates base62 encoding and decoding.Chilkat PHP Downloads
<?php
use Chilkat2\BinData;
use Chilkat2\StringBuilder;
$bd = new BinData();
// Base62 encode.
$bd->AppendString('hello world', 'utf-8');
$base62_encoded = $bd->GetEncoded('base62');
echo 'hello world --> ', $base62_encoded, "\n";
// Output:
// hello world --> AAwf93rvy4aWQVw
// Base62 decode
$sb = new StringBuilder();
$sb->DecodeAndAppend('AAwf93rvy4aWQVw', 'base62', 'utf-8');
echo 'decoded: ', $sb->GetAsString(), "\n";
// Output:
// decoded: hello world