1--TEST--
2Test debug_zval_dump() function : basic operations
3--INI--
4precision=14
5--FILE--
6<?php
7
8/* creating file resource */
9$file_handle = fopen(__FILE__, "r");
10
11echo "*** Testing debug_zval_dump() on scalar and non-scalar variables ***\n";
12$values = array (
13  /* integers */
14  0,  // zero as argument
15  000000123,  //octal value of 83
16  123000000,
17  -00000123,  //octal value of 83
18  -12300000,
19  0xffffff,  //hexadecimal value
20  123456789,
21  1,
22  -1,
23
24  /* floats */
25  -0.0,
26  +0.0,
27  1.234,
28  -1.234,
29  -2.000000,
30  2.0000000,
31  -4.0001e+5,
32  4.0001E+5,
33  6.99999989,
34  -.5,
35  .567,
36  -.6700000e-3,
37  -.6700000E+3,
38  1E-5,
39  -1e+5,
40  1e+5,
41  1E-5,
42
43  /* strings */
44  "",
45  '',
46  " ",
47  ' ',
48  "0",
49  "\0",
50  '\0',
51  "\t",
52  '\t',
53  "PHP",
54  'PHP',
55  "1234\t\n5678\n\t9100\rabcda\x0000cdeh\0stuv",  // strings with escape chars
56
57  /* boolean */
58  TRUE,
59  FALSE,
60  true,
61  false,
62
63  /* arrays */
64  array(),
65  array(NULL),
66  array(true),
67  array(""),
68  array(''),
69  array(array(1, 2), array('a', 'b')),
70  array("test" => "is_array", 1 => 'One'),
71  array(0),
72  array(-1),
73  array(10.5, 5.6),
74  array("string", "test"),
75  array('string', 'test'),
76
77  /* resources */
78  $file_handle
79);
80/* loop to display the variables and its reference count using
81    debug_zval_dump() */
82$counter = 1;
83foreach( $values as $value ) {
84  echo "-- Iteration $counter --\n";
85  debug_zval_dump( $value );
86  $counter++;
87}
88
89/* closing resource handle */
90fclose($file_handle);
91
92echo "Done\n";
93?>
94--EXPECTF--
95*** Testing debug_zval_dump() on scalar and non-scalar variables ***
96-- Iteration 1 --
97int(0)
98-- Iteration 2 --
99int(83)
100-- Iteration 3 --
101int(123000000)
102-- Iteration 4 --
103int(-83)
104-- Iteration 5 --
105int(-12300000)
106-- Iteration 6 --
107int(16777215)
108-- Iteration 7 --
109int(123456789)
110-- Iteration 8 --
111int(1)
112-- Iteration 9 --
113int(-1)
114-- Iteration 10 --
115float(-0)
116-- Iteration 11 --
117float(0)
118-- Iteration 12 --
119float(1.234)
120-- Iteration 13 --
121float(-1.234)
122-- Iteration 14 --
123float(-2)
124-- Iteration 15 --
125float(2)
126-- Iteration 16 --
127float(-400010)
128-- Iteration 17 --
129float(400010)
130-- Iteration 18 --
131float(6.99999989)
132-- Iteration 19 --
133float(-0.5)
134-- Iteration 20 --
135float(0.567)
136-- Iteration 21 --
137float(-0.00067)
138-- Iteration 22 --
139float(-670)
140-- Iteration 23 --
141float(1.0E-5)
142-- Iteration 24 --
143float(-100000)
144-- Iteration 25 --
145float(100000)
146-- Iteration 26 --
147float(1.0E-5)
148-- Iteration 27 --
149string(0) "" refcount(%d)
150-- Iteration 28 --
151string(0) "" refcount(%d)
152-- Iteration 29 --
153string(1) " " refcount(%d)
154-- Iteration 30 --
155string(1) " " refcount(%d)
156-- Iteration 31 --
157string(1) "0" refcount(%d)
158-- Iteration 32 --
159string(1) "�" refcount(%d)
160-- Iteration 33 --
161string(2) "\0" refcount(%d)
162-- Iteration 34 --
163string(1) "	" refcount(%d)
164-- Iteration 35 --
165string(2) "\t" refcount(%d)
166-- Iteration 36 --
167string(3) "PHP" refcount(%d)
168-- Iteration 37 --
169string(3) "PHP" refcount(%d)
170-- Iteration 38 --
171string(34) "1234
1725678
173	9100
173abcda�00cdeh�stuv" refcount(%d)
174-- Iteration 39 --
175bool(true)
176-- Iteration 40 --
177bool(false)
178-- Iteration 41 --
179bool(true)
180-- Iteration 42 --
181bool(false)
182-- Iteration 43 --
183array(0) refcount(%d){
184}
185-- Iteration 44 --
186array(1) refcount(%d){
187  [0]=>
188  NULL
189}
190-- Iteration 45 --
191array(1) refcount(%d){
192  [0]=>
193  bool(true)
194}
195-- Iteration 46 --
196array(1) refcount(%d){
197  [0]=>
198  string(0) "" refcount(%d)
199}
200-- Iteration 47 --
201array(1) refcount(%d){
202  [0]=>
203  string(0) "" refcount(%d)
204}
205-- Iteration 48 --
206array(2) refcount(%d){
207  [0]=>
208  array(2) refcount(%d){
209    [0]=>
210    int(1)
211    [1]=>
212    int(2)
213  }
214  [1]=>
215  array(2) refcount(%d){
216    [0]=>
217    string(1) "a" refcount(%d)
218    [1]=>
219    string(1) "b" refcount(%d)
220  }
221}
222-- Iteration 49 --
223array(2) refcount(%d){
224  ["test"]=>
225  string(8) "is_array" refcount(%d)
226  [1]=>
227  string(3) "One" refcount(%d)
228}
229-- Iteration 50 --
230array(1) refcount(%d){
231  [0]=>
232  int(0)
233}
234-- Iteration 51 --
235array(1) refcount(%d){
236  [0]=>
237  int(-1)
238}
239-- Iteration 52 --
240array(2) refcount(%d){
241  [0]=>
242  float(10.5)
243  [1]=>
244  float(5.6)
245}
246-- Iteration 53 --
247array(2) refcount(%d){
248  [0]=>
249  string(6) "string" refcount(%d)
250  [1]=>
251  string(4) "test" refcount(%d)
252}
253-- Iteration 54 --
254array(2) refcount(%d){
255  [0]=>
256  string(6) "string" refcount(%d)
257  [1]=>
258  string(4) "test" refcount(%d)
259}
260-- Iteration 55 --
261resource(%d) of type (stream) refcount(%d)
262Done
263