summaryrefslogtreecommitdiff
path: root/tests/lang/integer_literals/hexadecimal_32bit.phpt
blob: 1793354a5d266c39bbba29cbf05246239c6eae89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
--TEST--
Hexadecimal integer strings (32bit)
--SKIPIF--
<?php
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
?>
--FILE--
<?php
/* Using hexadecimal prefix notation lowercase */
/* Maximum value representable as integer */
$hex = 0x7FFFFFFF;
var_dump($hex);
var_dump(PHP_INT_MAX);

/* Floating number */
$hex = 0x45FFFABCDE0000000;
var_dump($hex);

/* Integer */
$hex = 0x1C;
var_dump($hex);

/* underscore separator */
$hex = 0x1_C;
var_dump($hex);

/* Ignore leading 0 and _ */
$hex = 0x0_01C;
var_dump($hex);
$hex = 0x0_1C;
var_dump($hex);

/* Overflow to infinity */
$hex = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
var_dump($hex);

/* Using hexadecimal prefix notation uppercase */
/* Maximum value representable as integer */
$hex = 0X7FFFFFFF;
var_dump($hex);
var_dump(PHP_INT_MAX);

/* Floating number */
$hex = 0X45FFFABCDE0000000;
var_dump($hex);

/* Integer */
$hex = 0X1C;
var_dump($hex);

/* underscore separator */
$hex = 0X1_C;
var_dump($hex);

/* Ignore leading 0 and _ */
$hex = 0X0_01C;
var_dump($hex);
$hex = 0X0_1C;
var_dump($hex);

/* Overflow to infinity */
$hex = 0XFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
var_dump($hex);

?>
--EXPECT--
int(2147483647)
int(2147483647)
float(8.070441274821732E+19)
int(28)
int(28)
int(28)
int(28)
float(INF)
int(2147483647)
int(2147483647)
float(8.070441274821732E+19)
int(28)
int(28)
int(28)
int(28)
float(INF)