An alternative to base_convert() : gmp_strval « String « PHP






An alternative to base_convert()

 
<?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";
?>
  
  








Related examples in the same category