1--TEST--
2Test var_export() function with integer values
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE > 4) {
6        die("skip 32-bit only");
7}
8?>
9--FILE--
10<?php
11/* Prototype  : mixed var_export(mixed var [, bool return])
12 * Description: Outputs or returns a string representation of a variable
13 * Source code: ext/standard/var.c
14 * Alias to functions:
15 */
16
17echo "*** Testing var_export() with integer values ***\n";
18// different integer vlaues
19$valid_ints = array(
20                '0' => '0',
21                '1' => '1',
22                '-1' => '-1',
23                '-2147483648' => '-2147483648', // max negative integer value
24                '-2147483647' => '-2147483647',
25                '2147483647' => 2147483647,  // max positive integer value
26                '2147483640' => 2147483640,
27                '0x123B' => 0x123B,      // integer as hexadecimal
28                "'0x12ab'" => '0x12ab',
29                "'0Xfff'" => '0Xfff',
30                "'0XFA'" => '0XFA',
31                "-0x80000000" => -0x7FFFFFFF - 1, // max negative integer as hexadecimal
32                "'0x7fffffff'" => '0x7fffffff',  // max positive integer as hexadecimal
33                "0x7FFFFFFF" => 0x7FFFFFFF,  // max positive integer as hexadecimal
34                "'0123'" => '0123',        // integer as octal
35                "01912" => 01,       // should be quivalent to octal 1
36                "-020000000000" => -017777777777 - 1, // max negative integer as octal
37                "017777777777" => 017777777777,  // max positive integer as octal
38);
39
40/* Loop to check for above integer values with var_export() */
41echo "\n*** Output for integer values ***\n";
42foreach($valid_ints as $key => $int_value) {
43	echo "\n-- Iteration: $key --\n";
44	var_export( $int_value );
45	echo "\n";
46	var_export( $int_value, FALSE);
47	echo "\n";
48	var_dump( var_export( $int_value, TRUE) );
49}
50
51?>
52===DONE===
53--EXPECT--
54*** Testing var_export() with integer values ***
55
56*** Output for integer values ***
57
58-- Iteration: 0 --
59'0'
60'0'
61string(3) "'0'"
62
63-- Iteration: 1 --
64'1'
65'1'
66string(3) "'1'"
67
68-- Iteration: -1 --
69'-1'
70'-1'
71string(4) "'-1'"
72
73-- Iteration: -2147483648 --
74'-2147483648'
75'-2147483648'
76string(13) "'-2147483648'"
77
78-- Iteration: -2147483647 --
79'-2147483647'
80'-2147483647'
81string(13) "'-2147483647'"
82
83-- Iteration: 2147483647 --
842147483647
852147483647
86string(10) "2147483647"
87
88-- Iteration: 2147483640 --
892147483640
902147483640
91string(10) "2147483640"
92
93-- Iteration: 0x123B --
944667
954667
96string(4) "4667"
97
98-- Iteration: '0x12ab' --
99'0x12ab'
100'0x12ab'
101string(8) "'0x12ab'"
102
103-- Iteration: '0Xfff' --
104'0Xfff'
105'0Xfff'
106string(7) "'0Xfff'"
107
108-- Iteration: '0XFA' --
109'0XFA'
110'0XFA'
111string(6) "'0XFA'"
112
113-- Iteration: -0x80000000 --
114-2147483647-1
115-2147483647-1
116string(13) "-2147483647-1"
117
118-- Iteration: '0x7fffffff' --
119'0x7fffffff'
120'0x7fffffff'
121string(12) "'0x7fffffff'"
122
123-- Iteration: 0x7FFFFFFF --
1242147483647
1252147483647
126string(10) "2147483647"
127
128-- Iteration: '0123' --
129'0123'
130'0123'
131string(6) "'0123'"
132
133-- Iteration: 01912 --
1341
1351
136string(1) "1"
137
138-- Iteration: -020000000000 --
139-2147483647-1
140-2147483647-1
141string(13) "-2147483647-1"
142
143-- Iteration: 017777777777 --
1442147483647
1452147483647
146string(10) "2147483647"
147===DONE===
148