1--TEST--
2Test token_get_all() function : usage variations - with bitwise 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 bitwise operators to test them for token
12 *  << - T_SL(287)
13 *  >> - T_SR(286)
14*/
15
16echo "*** Testing token_get_all() : 'source' string with different bitwise operators ***\n";
17
18// bitwise operators : '<<' , '>>'
19$source = '<?php
20$a = 2, $b = 4;
21$a = $a << 2;
22$b = $b >> 2;
23var_dump($a);
24var_dump($b);
25?>';
26var_dump( token_get_all($source));
27
28echo "Done"
29?>
30--EXPECTF--
31*** Testing token_get_all() : 'source' string with different bitwise operators ***
32array(50) {
33  [0]=>
34  array(3) {
35    [0]=>
36    int(368)
37    [1]=>
38    string(6) "<?php
39"
40    [2]=>
41    int(1)
42  }
43  [1]=>
44  array(3) {
45    [0]=>
46    int(309)
47    [1]=>
48    string(2) "$a"
49    [2]=>
50    int(2)
51  }
52  [2]=>
53  array(3) {
54    [0]=>
55    int(371)
56    [1]=>
57    string(1) " "
58    [2]=>
59    int(2)
60  }
61  [3]=>
62  string(1) "="
63  [4]=>
64  array(3) {
65    [0]=>
66    int(371)
67    [1]=>
68    string(1) " "
69    [2]=>
70    int(2)
71  }
72  [5]=>
73  array(3) {
74    [0]=>
75    int(305)
76    [1]=>
77    string(1) "2"
78    [2]=>
79    int(2)
80  }
81  [6]=>
82  string(1) ","
83  [7]=>
84  array(3) {
85    [0]=>
86    int(371)
87    [1]=>
88    string(1) " "
89    [2]=>
90    int(2)
91  }
92  [8]=>
93  array(3) {
94    [0]=>
95    int(309)
96    [1]=>
97    string(2) "$b"
98    [2]=>
99    int(2)
100  }
101  [9]=>
102  array(3) {
103    [0]=>
104    int(371)
105    [1]=>
106    string(1) " "
107    [2]=>
108    int(2)
109  }
110  [10]=>
111  string(1) "="
112  [11]=>
113  array(3) {
114    [0]=>
115    int(371)
116    [1]=>
117    string(1) " "
118    [2]=>
119    int(2)
120  }
121  [12]=>
122  array(3) {
123    [0]=>
124    int(305)
125    [1]=>
126    string(1) "4"
127    [2]=>
128    int(2)
129  }
130  [13]=>
131  string(1) ";"
132  [14]=>
133  array(3) {
134    [0]=>
135    int(371)
136    [1]=>
137    string(1) "
138"
139    [2]=>
140    int(2)
141  }
142  [15]=>
143  array(3) {
144    [0]=>
145    int(309)
146    [1]=>
147    string(2) "$a"
148    [2]=>
149    int(3)
150  }
151  [16]=>
152  array(3) {
153    [0]=>
154    int(371)
155    [1]=>
156    string(1) " "
157    [2]=>
158    int(3)
159  }
160  [17]=>
161  string(1) "="
162  [18]=>
163  array(3) {
164    [0]=>
165    int(371)
166    [1]=>
167    string(1) " "
168    [2]=>
169    int(3)
170  }
171  [19]=>
172  array(3) {
173    [0]=>
174    int(309)
175    [1]=>
176    string(2) "$a"
177    [2]=>
178    int(3)
179  }
180  [20]=>
181  array(3) {
182    [0]=>
183    int(371)
184    [1]=>
185    string(1) " "
186    [2]=>
187    int(3)
188  }
189  [21]=>
190  array(3) {
191    [0]=>
192    int(287)
193    [1]=>
194    string(2) "<<"
195    [2]=>
196    int(3)
197  }
198  [22]=>
199  array(3) {
200    [0]=>
201    int(371)
202    [1]=>
203    string(1) " "
204    [2]=>
205    int(3)
206  }
207  [23]=>
208  array(3) {
209    [0]=>
210    int(305)
211    [1]=>
212    string(1) "2"
213    [2]=>
214    int(3)
215  }
216  [24]=>
217  string(1) ";"
218  [25]=>
219  array(3) {
220    [0]=>
221    int(371)
222    [1]=>
223    string(1) "
224"
225    [2]=>
226    int(3)
227  }
228  [26]=>
229  array(3) {
230    [0]=>
231    int(309)
232    [1]=>
233    string(2) "$b"
234    [2]=>
235    int(4)
236  }
237  [27]=>
238  array(3) {
239    [0]=>
240    int(371)
241    [1]=>
242    string(1) " "
243    [2]=>
244    int(4)
245  }
246  [28]=>
247  string(1) "="
248  [29]=>
249  array(3) {
250    [0]=>
251    int(371)
252    [1]=>
253    string(1) " "
254    [2]=>
255    int(4)
256  }
257  [30]=>
258  array(3) {
259    [0]=>
260    int(309)
261    [1]=>
262    string(2) "$b"
263    [2]=>
264    int(4)
265  }
266  [31]=>
267  array(3) {
268    [0]=>
269    int(371)
270    [1]=>
271    string(1) " "
272    [2]=>
273    int(4)
274  }
275  [32]=>
276  array(3) {
277    [0]=>
278    int(286)
279    [1]=>
280    string(2) ">>"
281    [2]=>
282    int(4)
283  }
284  [33]=>
285  array(3) {
286    [0]=>
287    int(371)
288    [1]=>
289    string(1) " "
290    [2]=>
291    int(4)
292  }
293  [34]=>
294  array(3) {
295    [0]=>
296    int(305)
297    [1]=>
298    string(1) "2"
299    [2]=>
300    int(4)
301  }
302  [35]=>
303  string(1) ";"
304  [36]=>
305  array(3) {
306    [0]=>
307    int(371)
308    [1]=>
309    string(1) "
310"
311    [2]=>
312    int(4)
313  }
314  [37]=>
315  array(3) {
316    [0]=>
317    int(307)
318    [1]=>
319    string(8) "var_dump"
320    [2]=>
321    int(5)
322  }
323  [38]=>
324  string(1) "("
325  [39]=>
326  array(3) {
327    [0]=>
328    int(309)
329    [1]=>
330    string(2) "$a"
331    [2]=>
332    int(5)
333  }
334  [40]=>
335  string(1) ")"
336  [41]=>
337  string(1) ";"
338  [42]=>
339  array(3) {
340    [0]=>
341    int(371)
342    [1]=>
343    string(1) "
344"
345    [2]=>
346    int(5)
347  }
348  [43]=>
349  array(3) {
350    [0]=>
351    int(307)
352    [1]=>
353    string(8) "var_dump"
354    [2]=>
355    int(6)
356  }
357  [44]=>
358  string(1) "("
359  [45]=>
360  array(3) {
361    [0]=>
362    int(309)
363    [1]=>
364    string(2) "$b"
365    [2]=>
366    int(6)
367  }
368  [46]=>
369  string(1) ")"
370  [47]=>
371  string(1) ";"
372  [48]=>
373  array(3) {
374    [0]=>
375    int(371)
376    [1]=>
377    string(1) "
378"
379    [2]=>
380    int(6)
381  }
382  [49]=>
383  array(3) {
384    [0]=>
385    int(370)
386    [1]=>
387    string(2) "?>"
388    [2]=>
389    int(7)
390  }
391}
392Done
393