Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

gmp_com

Description

The gmp_com of GMP for PHP calculates one's complement.

Syntax

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

Parameters

num

A GMP object, an int or a numeric string.

Return

Returns the one's complement of num, as a GMP object.

Examples

1 · num · GMP

<?

$num = 1;

$num = gmp_init($num);

$return = gmp_com($num);

var_dump($return);

?>
object(GMP)#2 (1) {
  ["num"]=>
  string(2) "-2"
}

2 · num · int

<?

$num = 1;

$return = gmp_com($num);

var_dump($return);

?>
object(GMP)#1 (1) {
  ["num"]=>
  string(2) "-2"
}

3 · num · string

<?

$num = "1";

$return = gmp_com($num);

var_dump($return);

?>
object(GMP)#1 (1) {
  ["num"]=>
  string(2) "-2"
}
HomeMenu