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