本文整理汇总了PHP中UUID::bignum方法的典型用法代码示例。如果您正苦于以下问题:PHP UUID::bignum方法的具体用法?PHP UUID::bignum怎么用?PHP UUID::bignum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UUID
的用法示例。
在下文中一共展示了UUID::bignum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initBignum
public static function initBignum($how = NULL)
{
/* Check to see if PHP is running in a 32-bit environment and if so,
use GMP or BC Math if available. */
if ($how === NULL) {
if (self::$bignum != self::bigChoose) {
// determination has already been made
return self::$bignum;
} else {
if (PHP_INT_SIZE >= 8) {
self::$bignum = self::bigNative;
} else {
if (function_exists("gmp_add")) {
self::$bignum = self::bigGMP;
} else {
if (function_exists("bcadd")) {
self::$bignum = self::bigBC;
} else {
self::$bignum = self::bigNot;
}
}
}
}
} else {
switch ($how) {
case self::bigChoose:
self::$bignum = $how;
return self::initBignum();
case self::bigNot:
break;
case self::bigNative:
if (PHP_INT_SIZE < 8) {
throw new UUIDException("Bignum method is not available.", 801);
}
break;
case self::bigGMP:
if (!function_exists("gmp_add")) {
throw new UUIDException("Bignum method is not available.", 801);
}
break;
case self::bigBC:
if (!function_exists("bcadd")) {
throw new UUIDException("Bignum method is not available.", 801);
}
break;
default:
throw new UUIDException("Bignum method not implemented.", 901);
}
self::$bignum = $how;
}
return self::$bignum;
}