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