PHP Alternative To Base_Convert() – String Function

<?php
if (!extension_loaded("gmp")) {
  dl("php_gmp.dll");
}function gmp_convert($num, $base_a, $base_b)
{
       return gmp_strval(gmp_init($num, $base_a), $base_b);
}echo "12345678987654321 in hex is: " . gmp_convert('12345678987654321', 10, 16) . "\n";
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.