/ Published in: PHP
Allows you to convert to any base between 2 and 255, effectively using all the ASCII characters.
In order to convert very large numbers with arbitrary precision you’ll need the BCMath lib. Without BCMath the large numbers will not be converted correctly due to PHP not being able to do the arithmetic.
In order to convert very large numbers with arbitrary precision you’ll need the BCMath lib. Without BCMath the large numbers will not be converted correctly due to PHP not being able to do the arithmetic.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
return $quotient; } $remainder = $dividend%$modulo; return $remainder; } } /** * Convert Decimal to a base less then 255 comprised of ASCII chars * * @param Int $num * @param Int $base (2-255) * @return ASCII String */ function base255($num, $base = 255) { if ($num < 0) $num = -$num; while($num > $base) { } }
URL: http://www.bucabay.com/php/base-conversion-in-php-radix-255/