Javatpoint Logo
Javatpoint Logo

PHP gmp_invert() Function

PHP has a function called GMP invert() that finds the modular inverse of a GMP number under another GMP number.

Syntax

The following syntax shows the PHP GMP invert function.

Parameters

  • As you can see in the above syntax, this function takes two GMP numbers, $ numbers1 and $ numbers2.
  • This function finds the opposite of $a when $b is divided by $a. In PHP versions 5.6 and later, these parameters can be GMP objects.
  • We can also pass a numeric string as long as that string turns into a number.

Return Values

  • This function gives back a GMP number that is the inverse modulo of the two numbers it was given as arguments.
  • If the given two numbers cannot be used to find the inverse modulo, this function will return FALSE.

Examples

The following example shows the modular inverse value from several parameters using the GMP function.

Example1: the following example shows the gmp_invert() function with a basic value. The given parameter shows modular inverse values of the given numbers.

Output:

The image shows the modular inverse value of the given value.

PHP gmp_invert() Function

Example2: the following example shows the gmp_invert() function with a basic negative value. We can use both negative values as parameters

Output:

The image shows the modular inverse value of the given value.

PHP gmp_invert() Function

Example3: the following example shows the gmp_invert() function with variable parameter and its value

Output:

The image shows the modular inverse value of the given value.

PHP gmp_invert() Function

Example4: the following example shows the gmp_invert() function with positive and negative variable values. We can use both positive and negative values as parameters.

Output:

The image shows the modular inverse value of the given value.

PHP gmp_invert() Function

Example5: the following example shows the gmp_invert() function using the variable values with GMP parameters. We can use both positive and negative values in the GMP parameters.

Output:

The image shows the modular inverse value of the given value.

PHP gmp_invert() Function

Conclusion

The gmp_invert() function displays the modular inverse integer value of the given numerical data.







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