gmp_abs
is a function of PHP that returns the absolute value of a
gmp_abs(GMP|int|string $num): GMP
The function takes in one parameter num
.
num
can be a numeric string, GMP object, or of type int.
The function returns the absolute value of num
. The value returned is of type GMP number.
<?php$absoluteVal1 = gmp_abs("-16567863358");$absoluteVal2 = gmp_abs("-1346023511");echo gmp_strval($absoluteVal1) . "\n";echo gmp_strval($absoluteVal2) . "\n";?>
16567863358
1346023511