summaryrefslogtreecommitdiff
path: root/ext/standard/tests/general_functions/var_export_basic1_32.phpt
blob: 61e69c63151ac72a843c0247e78c02d3c4fb031f (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
--TEST--
Test var_export() function with integer values
--SKIPIF--
<?php
if (PHP_INT_SIZE > 4) {
        die("skip 32-bit only");
}
?>
--FILE--
<?php
/* Prototype  : mixed var_export(mixed var [, bool return])
 * Description: Outputs or returns a string representation of a variable
 * Source code: ext/standard/var.c
 * Alias to functions:
 */

echo "*** Testing var_export() with integer values ***\n";
// different integer vlaues
$valid_ints = array(
                '0' => '0',
                '1' => '1',
                '-1' => '-1',
                '-2147483648' => '-2147483648', // max negative integer value
                '-2147483647' => '-2147483647',
                '2147483647' => 2147483647,  // max positive integer value
                '2147483640' => 2147483640,
                '0x123B' => 0x123B,      // integer as hexadecimal
                "'0x12ab'" => '0x12ab',
                "'0Xfff'" => '0Xfff',
                "'0XFA'" => '0XFA',
                "-0x80000000" => -0x7FFFFFFF - 1, // max negative integer as hexadecimal
                "'0x7fffffff'" => '0x7fffffff',  // max positive integer as hexadecimal
                "0x7FFFFFFF" => 0x7FFFFFFF,  // max positive integer as hexadecimal
                "'0123'" => '0123',        // integer as octal
                "01912" => 01,       // should be quivalent to octal 1
                "-020000000000" => -017777777777 - 1, // max negative integer as octal
                "017777777777" => 017777777777,  // max positive integer as octal
);

/* Loop to check for above integer values with var_export() */
echo "\n*** Output for integer values ***\n";
foreach($valid_ints as $key => $int_value) {
	echo "\n-- Iteration: $key --\n";
	var_export( $int_value );
	echo "\n";
	var_export( $int_value, FALSE);
	echo "\n";
	var_dump( var_export( $int_value, TRUE) );
}

?>
--EXPECT--
*** Testing var_export() with integer values ***

*** Output for integer values ***

-- Iteration: 0 --
'0'
'0'
string(3) "'0'"

-- Iteration: 1 --
'1'
'1'
string(3) "'1'"

-- Iteration: -1 --
'-1'
'-1'
string(4) "'-1'"

-- Iteration: -2147483648 --
'-2147483648'
'-2147483648'
string(13) "'-2147483648'"

-- Iteration: -2147483647 --
'-2147483647'
'-2147483647'
string(13) "'-2147483647'"

-- Iteration: 2147483647 --
2147483647
2147483647
string(10) "2147483647"

-- Iteration: 2147483640 --
2147483640
2147483640
string(10) "2147483640"

-- Iteration: 0x123B --
4667
4667
string(4) "4667"

-- Iteration: '0x12ab' --
'0x12ab'
'0x12ab'
string(8) "'0x12ab'"

-- Iteration: '0Xfff' --
'0Xfff'
'0Xfff'
string(7) "'0Xfff'"

-- Iteration: '0XFA' --
'0XFA'
'0XFA'
string(6) "'0XFA'"

-- Iteration: -0x80000000 --
-2147483647-1
-2147483647-1
string(13) "-2147483647-1"

-- Iteration: '0x7fffffff' --
'0x7fffffff'
'0x7fffffff'
string(12) "'0x7fffffff'"

-- Iteration: 0x7FFFFFFF --
2147483647
2147483647
string(10) "2147483647"

-- Iteration: '0123' --
'0123'
'0123'
string(6) "'0123'"

-- Iteration: 01912 --
1
1
string(1) "1"

-- Iteration: -020000000000 --
-2147483647-1
-2147483647-1
string(13) "-2147483647-1"

-- Iteration: 017777777777 --
2147483647
2147483647
string(10) "2147483647"