gmp_sign
is a function in PHP which checks the sign of a GMP number.
gmp_sign(GMP|int|string $num): int
The function takes in one parameter num
.
num
can be a numeric string or GMP object.
The function returns 1 if num
is positive.
The function returns -1 if num
is negative.
The function returns 0 if num
is 0.
<?phpecho gmp_sign("550") . "\n";echo gmp_sign("-700") . "\n";echo gmp_sign("0") . "\n";?>
1
-1
0