update page now

gmp_fact

(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)

gmp_fact階乗

説明

gmp_fact(GMP|int|string $num): GMP

num の階乗 (num!) を計算します。

パラメータ

num

階乗を求める数。

GMP オブジェクト、int、 あるいは数値として解釈可能な string。 文字列の場合、gmp_init() で基数を自動検出するとき (base に 0 を指定したとき) と同じ方法で解釈されます。

戻り値

GMP オブジェクトを返します。

例1 gmp_fact() の例

<?php
$fact1
= gmp_fact(5); // 5 * 4 * 3 * 2 * 1
echo gmp_strval($fact1) . "\n";

$fact2 = gmp_fact(50); // 50 * 49 * 48, ... etc
echo gmp_strval($fact2) . "\n";
?>

上の例の出力は以下となります。

120
30414093201713378043612608166064768844377641568960512000000000000

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top