PHP.nl

gmp_sign

gmp_sign

Sign of number

int **gmp_sign**  $num

Checks the sign of a number.

num Either a object, or a numeric string provided that it is possible to convert the latter to an . GMP``int

Returns 1 if is positive, -1 if is negative, and 0 if is zero. num``num``num

Voorbeeld: example

<?php
// positive
echo gmp_sign("500") . "\n";

// negative
echo gmp_sign("-500") . "\n";

// zero
echo gmp_sign("0") . "\n";
?>
1
-1
0

gmp_abs``abs