<?php
int gmp_sign ( GMP|int|string $num )
where,
$num = Parameter to be checked
?>
<?php
function signtest($a01)
{
if( gmp_sign($a01) == 1 )
{
echo $a01 . ' is positive.<br><br>';
}
elseif( gmp_sign($a01) == -1 )
{
echo $a01 . ' is negative.<br><br>';
}
else
{
echo $a01 . ' is neither negative nor positive.<br><br>';
}
}
$a01a = 256;
$a01b = -256;
$a01c = '256';
$a01d = '0';
$a01e = 'TEST';
signtest($a01a);
signtest($a01b);
signtest($a01c);
signtest($a01d);
/*
Try the next in PHP 7.4.XX and in PHP 8.0.XX
to see the differences
*/
// signtest($a01e);
?>