1. Go to this page and download the library: Download thunderer/numbase 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/ */
thunderer / numbase example snippets
use Thunder\Numbase\Numbase;
$numbase = Numbase::createDefault();
// decimal 15 to hexadecimal number
assert('F' === $numbase->convert(15, 10, 16));
// 64000 decimal to base 32000
assert('20' === $numbase->convert(64000, 10, 32000));
use Thunder\Numbase\Numbase;
$base62 = new Base62Symbols();
$numbase = new Numbase(new GmpConverter($base62), new StrictFormatter($base62));
// decimal 15 to hexadecimal number
assert('F' === $numbase->convert(15, 10, 16));
$base10 = new Base10Symbols();
$upper = new StringSymbols('!@#$%^&*()');
$numbase = new Numbase(new GmpDigits($base10), new StrictFormatter($upper));
assert('#!' === $numbase->convert('20', 10, 10));
assert('-$!' === $numbase->convert('-30', 10, 10));
$numbase = new Numbase(new GmpDigits($upper), new StrictFormatter($base10));
assert('20' === $numbase->convert('#!', 10, 10));
assert('-30' === $numbase->convert('-$!', 10, 10));
$numbase = new Numbase(new GmpDigits(new Base62Symbols()), new ArrayFormatter());
// convert 10^12 to base 99:
assert(array('10', '61', '53', '3', '51', '60', '10')
=== $numbase->convert('10000000000000', 10, 99));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.