Requires the Hack Standard Library to be installed.
Facebook Engineer?

This function is available as Math\base_convert() in Facebook's www repository.

Converts the given string in base $from_base to base $to_base, assuming letters a-z are used for digits for bases greater than 10

namespace HH\Lib\Math;

function base_convert(
  string $value,
  int $from_base,
  int $to_base,
): string;

The conversion is done to arbitrary precision.


  • string $value
  • int $from_base
  • int $to_base


  • string