Javatpoint Logo
Javatpoint Logo

PHP gmp_fact() Function

The factorial number of the largest value is difficult to determine using mathematical operation. PHP language-made function gmp_fact() is used to figure out the factorial number of a GMP parameter. The gmp_fact() function displays factorial data in a single line of code.

Syntax

The given syntax shows the PHP GMP function to find factorial.

Parameters

  • As shown in the above syntax, this function requires a GMP number as a required parameter.
  • In PHP 5.6 version and later, it can be a GMP object or a string of numbers that turns into a number.
  • This function figures out the factorial of the given number and return the output.

Return Values

This function gives back a GMP number that is the factorial of the parameter number.

Examples

The given examples show the factorial number of the given GMP parameters.

Example1: the given example shows a basic factorial operation with GMP value. The gmp_fact() function uses simple and positive values.

Output:

The following output shows a factorial number of the given positive value.

PHP gmp_fact() Function

Example2: the given example shows a factorial operation using the GMP function. The gmp_fact() function uses positive value using variable.

Output:

The following output shows a factorial number of the given variable value.

PHP gmp_fact() Function

Example3: the given example shows a factorial operation using another GMP function. here, we are using gmp_init() function for variable value.

Output:

The following output shows a factorial number of the given value.

PHP gmp_fact() Function

Example4: the given example shows a factorial operation using multiple GMP functions. Here, we are using gmp_init() function for variable value.

Output:

The following output shows a factorial number of the given value.

PHP gmp_fact() Function

Conclusion

The gmp_fact() function uses mathematical operations to get a factorial number. It is used for large numbers and to remove extra mathematical functions. This function helps to reduce code size using a single function.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA