本文整理汇总了PHP中CString::numberToBase方法的典型用法代码示例。如果您正苦于以下问题:PHP CString::numberToBase方法的具体用法?PHP CString::numberToBase怎么用?PHP CString::numberToBase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::numberToBase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: numberToBase
/**
* 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);
}