Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

php
factorial
gmp
communitycreator

What is gmp_fact in PHP?

Hammad Nasir

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

gmp_fact is a function in PHP that calculates the factorial of the argument passed.

Syntax

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

Parameters

The function takes in one parameter, num.

num can be a numeric string, GMPGNU Multiple Precision Arithmetic Library object, or an int type value.

Return value

The function returns the factorial of num. The value returned is a GMP type number.

Code

<?php
$val1 = gmp_fact(4);
echo gmp_strval($fact1) . "\n";
?>

Expected output

24

RELATED TAGS

php
factorial
gmp
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring