gmp_powm

(PHP 4 >= 4.0.4, PHP 5)

gmp_powmRaise number into power with modulo

說明

GMP gmp_powm ( GMP $base , GMP $exp , GMP $mod )

Calculate (base raised into power exp) modulo mod. If exp is negative, result is undefined.

參數

base

The base number.

可以是一個 GMP 數據 resouce,或一個可以轉換為數值的字串。

exp

The positive power to raise the base.

可以是一個 GMP 數據 resouce,或一個可以轉換為數值的字串。

mod

The modulo.

可以是一個 GMP 數據 resouce,或一個可以轉換為數值的字串。

回傳值

The new (raised) number, as a GMP number.

範例

Example #1 gmp_powm() example

<?php
$pow1 
gmp_powm("2""31""2147483649");
echo 
gmp_strval($pow1) . "\n";
?>

上例將輸出:

2147483648

add a note add a note

User Contributed Notes 1 note

up
1
jessietessie256 at gmail dot com
5 years ago
can be used for RSA encryption/decryption!
To Top