GMP gmp_pow
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp_pow — Raise number into power
설명
gmp_pow(GMP|int|string $num
, int $exponent
): GMP
Raise num into power exponent.
매개변수
num
- 기본 숫자입니다.
GMP 개체, int 또는 숫자 문자열입니다.
exponent
- The positive power to raise the
num
.
반환 값
GMP 번호로서의 새로운(상승된) 번호. 0^0
의 경우는 1을 산출합니다.
Examples
예제 #1 gmp_pow() 예제
<?php
$pow1 = gmp_pow("2", 31);
echo gmp_strval($pow1) . "\n";
$pow2 = gmp_pow("0", 0);
echo gmp_strval($pow2) . "\n";
$pow3 = gmp_pow("2", -1); // Negative exp, generates warning
echo gmp_strval($pow3) . "\n";
?>
위의 예는 다음을 출력합니다.
2147483648 1