PHP GMP gmp_com() Function

PHP has a built-in function called GMP or gmp_com() that is used to figure out the one's complement of a given GMP parameter.

Syntax

The following syntax shows the complement of the GMP number function.

Parameters:

  • The GMP number ($numbers) requires a parameter for the compliment function, as shown in the above syntax.
  • This function uses in PHP versions 5.6 and later. This parameter can be a GMP object.
  • We can also pass a numeric string value as long as it is possible to turn that string into a number.

Return Value:

This function returns a GMP number that is the one's complement of a GMP number passed to it as a parameter.

Examples

The following examples show the "gmp_com()" function using the GMP parameters.

Example1: The following example shows the GMP function's basic complementary operation.

Output:

The following output shows the complement values using the GMP function.

PHP GMP gmp_com() Function

Example2: the following example shows the complement of the given value using the "gmp_com()" operator.

Output:

The following output shows the complement values using the GMP function.

PHP GMP gmp_com() Function

Example3: the following example shows the complement of the given value with the "gmp_abs()" function.

Output:

The following output shows the complement values using the GMP parameter.

PHP GMP gmp_com() Function

Example4: the following example shows the complement of the given value with other operations and functions.

Output:

The following output shows the complement value using other functions.

PHP GMP gmp_com() Function

Conclusion

The "gmp_com()" function displays the complement of the two-parameter with a single operation. It is the numerical operation of GMP functions and parameters.