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