note 126273 deleted from function.gmp-cmp by cmb
| From: | cmb@php.net | Date: | Mon, 26 Jul 2021 08:11:02 +0000 |
| Subject: | note 126273 deleted from function.gmp-cmp by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216659@lists.php.net to get a copy of this message | ||
Note Submitter: vadym dot masiuk at gmail dot com
----
In some cases it will return 2 and -2, depend on provided values, if only 1 argument is negative,
for example:
<?php
$cmp1 = gmp_cmp("1234", "-1000"); // greater than
$cmp2 = gmp_cmp("-1000", "1234"); // less than
$cmp3 = gmp_cmp("-1234", "1000"); // less than
$cmp4 = gmp_cmp("1000", "-1234"); // greater than
echo "$cmp1 $cmp2 $cmp3 $cmp4\n";
?>
The above example will output: 2 -2 -2 2