gmp_neg
is a function in PHP that returns the negative of a GMP number.
The following illustration shows the visual representation of the gmp_neg
function.
gmp_neg(GMP|int|string $num): GMP
The function takes in one parameter: num
.
num
can be a numericstring
,object, or of the GMP GNU Multiple Precision Arithmetic Library int
type.
The function returns the negative of a number. The value returned is a GMP
type number.
<?php$val1 = gmp_neg("22");echo gmp_strval($val1) . "\n";$val2 = gmp_neg("-12456");echo gmp_strval($val2) . "\n";?>
-22
12456