xref: /PHP-7.3/ext/gmp/tests/comparison.phpt (revision 7713b8c2)
1--TEST--
2Overloaded GMP comparison in sort() etc
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8$arr = [gmp_init(0), -3, gmp_init(2), 1];
9sort($arr);
10var_dump($arr);
11
12var_dump(min(gmp_init(3), 4));
13var_dump(max(gmp_init(3), 4));
14
15?>
16--EXPECT--
17array(4) {
18  [0]=>
19  int(-3)
20  [1]=>
21  object(GMP)#1 (1) {
22    ["num"]=>
23    string(1) "0"
24  }
25  [2]=>
26  int(1)
27  [3]=>
28  object(GMP)#2 (1) {
29    ["num"]=>
30    string(1) "2"
31  }
32}
33object(GMP)#3 (1) {
34  ["num"]=>
35  string(1) "3"
36}
37int(4)
38