PHP Extension
PHP Extension
Base62 Encoding and Decoding
Demonstrates base62 encoding and decoding.Chilkat PHP Extension Downloads
<?php
include("chilkat.php");
$bd = new CkBinData();
// Base62 encode.
$bd->AppendString('hello world','utf-8');
$base62_encoded = $bd->getEncoded('base62');
print 'hello world --> ' . $base62_encoded . "\n";
// Output:
// hello world --> AAwf93rvy4aWQVw
// Base62 decode
$sb = new CkStringBuilder();
$sb->DecodeAndAppend('AAwf93rvy4aWQVw','base62','utf-8');
print 'decoded: ' . $sb->getAsString() . "\n";
// Output:
// decoded: hello world
?>