xref: /PHP-5.4/ext/gmp/tests/004.phpt (revision eb5bd09c)
1--TEST--
2gmp_intval() tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_intval(1,1));
9var_dump(gmp_intval(""));
10var_dump(gmp_intval(1.0001));
11var_dump(gmp_intval("1.0001"));
12var_dump(gmp_intval("-1"));
13var_dump(gmp_intval(-1));
14var_dump(gmp_intval(-2349828));
15var_dump(gmp_intval(2342344));
16var_dump(gmp_intval(new stdclass));
17var_dump(gmp_intval(array()));
18
19$fp = fopen(__FILE__, 'r');
20var_dump(gmp_intval($fp));
21
22$g = gmp_init("12345678");
23var_dump(gmp_intval($g));
24
25echo "Done\n";
26?>
27--EXPECTF--
28Warning: gmp_intval() expects exactly 1 parameter, 2 given in %s on line %d
29NULL
30int(0)
31int(1)
32int(1)
33int(-1)
34int(-1)
35int(-2349828)
36int(2342344)
37
38Notice: Object of class stdClass could not be converted to int in %s on line %d
39int(1)
40int(0)
41
42Warning: gmp_intval(): supplied resource is not a valid GMP integer resource in %s on line %d
43bool(false)
44int(12345678)
45Done
46