1--TEST--
2Test hexdec function : 64bit long tests
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6?>
7--FILE--
8<?php
9
10define("MAX_64Bit", 9223372036854775807);
11define("MAX_32Bit", 2147483647);
12define("MIN_64Bit", -9223372036854775807 - 1);
13define("MIN_32Bit", -2147483647 - 1);
14
15$hexLongStrs = array(
16   '7'.str_repeat('f',15),
17   str_repeat('f',16),
18   '7'.str_repeat('f',7),
19   str_repeat('f',8),
20   '7'.str_repeat('f',16),
21   str_repeat('f',18),
22   '7'.str_repeat('f',8),
23   str_repeat('f',9)
24);
25
26
27foreach ($hexLongStrs as $strVal) {
28   echo "--- testing: $strVal ---\n";
29   var_dump(hexdec($strVal));
30}
31
32?>
33--EXPECT--
34--- testing: 7fffffffffffffff ---
35int(9223372036854775807)
36--- testing: ffffffffffffffff ---
37float(1.8446744073709552E+19)
38--- testing: 7fffffff ---
39int(2147483647)
40--- testing: ffffffff ---
41int(4294967295)
42--- testing: 7ffffffffffffffff ---
43float(1.4757395258967641E+20)
44--- testing: ffffffffffffffffff ---
45float(4.722366482869645E+21)
46--- testing: 7ffffffff ---
47int(34359738367)
48--- testing: fffffffff ---
49int(68719476735)
50