1--TEST--
2Test hexdec() - basic function test hexdec()
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6?>
7--FILE--
8<?php
9echo "*** Testing hexdec() : basic functionality ***\n";
10
11$values = array(0x123abc,
12                0x789DEF,
13                0x7FFFFFFF,
14                0x80000000,
15                '0x123abc',
16                '0x789DEF',
17                '0x7FFFFFFF',
18                '0x80000000',
19                '0x123XYZABC',
20                311015,
21                '311015',
22                31101.3,
23                31.1013e5,
24                011237,
25                '011237',
26                true,
27                false,
28                );
29
30foreach($values as $value) {
31    echo "\n-- hexdec $value --\n";
32    var_dump(hexdec($value));
33};
34
35?>
36--EXPECTF--
37*** Testing hexdec() : basic functionality ***
38
39-- hexdec 1194684 --
40int(18433668)
41
42-- hexdec 7904751 --
43int(126895953)
44
45-- hexdec 2147483647 --
46int(142929835591)
47
48-- hexdec 2147483648 --
49int(142929835592)
50
51-- hexdec 0x123abc --
52int(1194684)
53
54-- hexdec 0x789DEF --
55int(7904751)
56
57-- hexdec 0x7FFFFFFF --
58int(2147483647)
59
60-- hexdec 0x80000000 --
61int(2147483648)
62
63-- hexdec 0x123XYZABC --
64
65Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
66int(1194684)
67
68-- hexdec 311015 --
69int(3215381)
70
71-- hexdec 311015 --
72int(3215381)
73
74-- hexdec 31101.3 --
75
76Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
77int(3215379)
78
79-- hexdec 3110130 --
80int(51446064)
81
82-- hexdec 4767 --
83int(18279)
84
85-- hexdec 011237 --
86int(70199)
87
88-- hexdec 1 --
89int(1)
90
91-- hexdec  --
92int(0)
93