Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

gmp_fact

Description

The gmp_fact of GMP for PHP factorial.

Syntax

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

Parameters

num

The factorial number.

A GMP object, an int or a numeric string.

Return

Returns a GMP object.

Examples

1 · num · GMP

<?

$num = 4;

$num = gmp_init($num);

$return = gmp_fact($num);

var_dump($return);
object(GMP)#2 (1) {
  ["num"]=>
  string(2) "24"
}

2 · num · int

<?

$num = 4;

$return = gmp_fact($num);

var_dump($return);
object(GMP)#1 (1) {
  ["num"]=>
  string(2) "24"
}

3 · num · string

<?

$num = "4";

$return = gmp_fact($num);

var_dump($return);
object(GMP)#1 (1) {
  ["num"]=>
  string(2) "24"
}
HomeMenu