(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp_sign — Sign of number
numEither a GMP object, or a numeric string provided that it is possible to convert the latter to an int.
Returns 1 if num is positive,
-1 if num is negative,
and 0 if num is zero.
Example #1 gmp_sign() example
<?php// positiveecho gmp_sign("500") . "\n";// negativeecho gmp_sign("-500") . "\n";// zeroecho gmp_sign("0") . "\n";?>The above example will output:
1 -1 0