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