Exemplo n.º 1
0
 /**
  * Converts a string with an arbitrary-base integer into the corresponding integer in a different base and returns
  * it as another string.
  *
  * The input string may be prefixed with "0x" for the source base of 16.
  *
  * @param  string $number The string with the number to be converted.
  * @param  int $fromBase The source base. Can be a number in the range from 2 to 36.
  * @param  int $toBase The destination base. Can be a number in the range from 2 to 36.
  *
  * @return string The string with the converted number.
  */
 public static function numberToBase($number, $fromBase, $toBase)
 {
     assert('is_cstring($number) && is_int($fromBase) && is_int($toBase)', vs(isset($this), get_defined_vars()));
     $number = self::normalize($number, self::NF_KC);
     return CString::numberToBase($number, $fromBase, $toBase);
 }