gmp_com() function in PHP


The gmp_com() function computes the one’s complement of a GMP number.

Syntax

gmp_com($val)

Parameters

  • val − The GMP number. It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.

Return

The gmp_com() function returns the one’s complement of a GMP number. The output is itself a GMP number.

Example

The following is an example −

<?php
   $val = "121";
   $a = gmp_com($val);
   echo $a;
?>

Output

The following is the output −

-122

Updated on: 30-Jun-2020

25 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements