PHP code example of mpyw / base-utf8

1. Go to this page and download the library: Download mpyw/base-utf8 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/ */

    

mpyw / base-utf8 example snippets



use Mpyw\BaseUTF8\Coder;

$coder = new Coder; // Base64
echo $coder->encode('foobar') . PHP_EOL; // Zm9vYmFy
echo $coder->decode('Zm9vYmFy') . PHP_EOL; // foobar
echo $coder->decode("Z  m  \n9v  Y\tmFy") . PHP_EOL; // foobar

$coder = new Coder('ABCDabcd'); // Base8
echo $coder->encode('foobar') . PHP_EOL; // DBacdbbdDAacAbcC
echo $coder->decode('DBacdbbdDAacAbcC') . PHP_EOL; // foobar

$coder = new Coder('ンアッーイキソ!'); // UTF-8 Base8
echo $coder->encode('田所浩二') . PHP_EOL;
echo $coder->decode('!ア!アッッソン!アキンイソンン!アキーッソキア!アアーキッアイ') . PHP_EOL;