1--TEST--
2Test token_get_all() function : usage variations - with increment/decrement operators
3--EXTENSIONS--
4tokenizer
5--FILE--
6<?php
7/*
8 * Passing 'source' argument with different increment/decrement operators to test them for token
9 *  ++ - T_INC(297)
10 *  -- - T_DEC(296)
11*/
12
13echo "*** Testing token_get_all() : 'source' string with different increment/decrement operators ***\n";
14
15// increment/decrement operators : '++' , '--'
16$source = '<?php
17$a = 10, $b = 5;
18$a++;
19$b--;
20echo $a;
21?>';
22var_dump(token_get_all($source));
23
24echo "Done"
25?>
26--EXPECTF--
27*** Testing token_get_all() : 'source' string with different increment/decrement operators ***
28array(29) {
29  [0]=>
30  array(3) {
31    [0]=>
32    int(%d)
33    [1]=>
34    string(6) "<?php
35"
36    [2]=>
37    int(1)
38  }
39  [1]=>
40  array(3) {
41    [0]=>
42    int(%d)
43    [1]=>
44    string(2) "$a"
45    [2]=>
46    int(2)
47  }
48  [2]=>
49  array(3) {
50    [0]=>
51    int(%d)
52    [1]=>
53    string(1) " "
54    [2]=>
55    int(2)
56  }
57  [3]=>
58  string(1) "="
59  [4]=>
60  array(3) {
61    [0]=>
62    int(%d)
63    [1]=>
64    string(1) " "
65    [2]=>
66    int(2)
67  }
68  [5]=>
69  array(3) {
70    [0]=>
71    int(%d)
72    [1]=>
73    string(2) "10"
74    [2]=>
75    int(2)
76  }
77  [6]=>
78  string(1) ","
79  [7]=>
80  array(3) {
81    [0]=>
82    int(%d)
83    [1]=>
84    string(1) " "
85    [2]=>
86    int(2)
87  }
88  [8]=>
89  array(3) {
90    [0]=>
91    int(%d)
92    [1]=>
93    string(2) "$b"
94    [2]=>
95    int(2)
96  }
97  [9]=>
98  array(3) {
99    [0]=>
100    int(%d)
101    [1]=>
102    string(1) " "
103    [2]=>
104    int(2)
105  }
106  [10]=>
107  string(1) "="
108  [11]=>
109  array(3) {
110    [0]=>
111    int(%d)
112    [1]=>
113    string(1) " "
114    [2]=>
115    int(2)
116  }
117  [12]=>
118  array(3) {
119    [0]=>
120    int(%d)
121    [1]=>
122    string(1) "5"
123    [2]=>
124    int(2)
125  }
126  [13]=>
127  string(1) ";"
128  [14]=>
129  array(3) {
130    [0]=>
131    int(%d)
132    [1]=>
133    string(1) "
134"
135    [2]=>
136    int(2)
137  }
138  [15]=>
139  array(3) {
140    [0]=>
141    int(%d)
142    [1]=>
143    string(2) "$a"
144    [2]=>
145    int(%d)
146  }
147  [16]=>
148  array(3) {
149    [0]=>
150    int(%d)
151    [1]=>
152    string(2) "++"
153    [2]=>
154    int(%d)
155  }
156  [17]=>
157  string(1) ";"
158  [18]=>
159  array(3) {
160    [0]=>
161    int(%d)
162    [1]=>
163    string(1) "
164"
165    [2]=>
166    int(%d)
167  }
168  [19]=>
169  array(3) {
170    [0]=>
171    int(%d)
172    [1]=>
173    string(2) "$b"
174    [2]=>
175    int(4)
176  }
177  [20]=>
178  array(3) {
179    [0]=>
180    int(%d)
181    [1]=>
182    string(2) "--"
183    [2]=>
184    int(4)
185  }
186  [21]=>
187  string(1) ";"
188  [22]=>
189  array(3) {
190    [0]=>
191    int(%d)
192    [1]=>
193    string(1) "
194"
195    [2]=>
196    int(4)
197  }
198  [23]=>
199  array(3) {
200    [0]=>
201    int(%d)
202    [1]=>
203    string(4) "echo"
204    [2]=>
205    int(5)
206  }
207  [24]=>
208  array(3) {
209    [0]=>
210    int(%d)
211    [1]=>
212    string(1) " "
213    [2]=>
214    int(5)
215  }
216  [25]=>
217  array(3) {
218    [0]=>
219    int(%d)
220    [1]=>
221    string(2) "$a"
222    [2]=>
223    int(5)
224  }
225  [26]=>
226  string(1) ";"
227  [27]=>
228  array(3) {
229    [0]=>
230    int(%d)
231    [1]=>
232    string(1) "
233"
234    [2]=>
235    int(5)
236  }
237  [28]=>
238  array(3) {
239    [0]=>
240    int(%d)
241    [1]=>
242    string(2) "?>"
243    [2]=>
244    int(6)
245  }
246}
247Done
248