PHP code example of nave-wata / base-conversion
1. Go to this page and download the library: Download nave-wata/base-conversion 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/ */
nave-wata / base-conversion example snippets
use NaveWata\BaseConversion\BaseConversion;
// Convert from binary
BaseConversion::binaryToDecimal('1111'); // 15
BaseConversion::binaryToHexadecimal('1111'); // F
// Convert from decimal
BaseConversion::decimalToBinary('2'); // 10
BaseConversion::decimalToHexadecimal('15'); // F
// Convert from hexadecimal
BaseConversion::hexadecimalToBinary('F'); // 1111
BaseConversion::hexadecimalToDecimal('F'); // 15
// Custom conversion
$custom = new BaseConversion('abcdefghijklmnopqrstuvwxyz');
$custom->decimalToCustom('25'); // z
$custom->customToDecimal('z'); // 25