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