1--TEST--
2Test token_get_all() function : basic functionality
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
12echo "*** Testing token_get_all() : basic functionality ***\n";
13
14// with php open/close tags
15$source = '<?php echo "Hello World"; ?>';
16echo "-- source string with PHP open and close tags --\n";
17var_dump( token_get_all($source) );
18
19// without php open/close tags testing for T_INLINE_HTML
20$source = "echo 'Hello World';";
21echo "-- source string without PHP open and close tags --\n";
22var_dump( token_get_all($source) );
23
24echo "Done"
25?>
26--EXPECTF--
27*** Testing token_get_all() : basic functionality ***
28-- source string with PHP open and close tags --
29array(7) {
30  [0]=>
31  array(3) {
32    [0]=>
33    int(%d)
34    [1]=>
35    string(6) "<?php "
36    [2]=>
37    int(1)
38  }
39  [1]=>
40  array(3) {
41    [0]=>
42    int(%d)
43    [1]=>
44    string(4) "echo"
45    [2]=>
46    int(1)
47  }
48  [2]=>
49  array(3) {
50    [0]=>
51    int(%d)
52    [1]=>
53    string(1) " "
54    [2]=>
55    int(1)
56  }
57  [3]=>
58  array(3) {
59    [0]=>
60    int(%d)
61    [1]=>
62    string(13) ""Hello World""
63    [2]=>
64    int(1)
65  }
66  [4]=>
67  string(1) ";"
68  [5]=>
69  array(3) {
70    [0]=>
71    int(%d)
72    [1]=>
73    string(1) " "
74    [2]=>
75    int(1)
76  }
77  [6]=>
78  array(3) {
79    [0]=>
80    int(%d)
81    [1]=>
82    string(2) "?>"
83    [2]=>
84    int(1)
85  }
86}
87-- source string without PHP open and close tags --
88array(1) {
89  [0]=>
90  array(3) {
91    [0]=>
92    int(%d)
93    [1]=>
94    string(19) "echo 'Hello World';"
95    [2]=>
96    int(1)
97  }
98}
99Done