1--TEST--
2Test token_get_all() function : usage variations - with HTML code
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 * Testing token_get_all() with source string containing HTML code with PHP
12 *   HTML tags are considered to be T_INLINE_HTML(311)
13*/
14
15echo "*** Testing token_get_all() : 'source' string with HTML tags ***\n";
16
17$source = '
18<html>
19<body>
20  Testing HTML
21</body>
22</html>"
23
24<?php
25  echo "php code with HTML";
26?>';
27var_dump( token_get_all($source));
28
29echo "Done"
30?>
31--EXPECTF--
32*** Testing token_get_all() : 'source' string with HTML tags ***
33array(9) {
34  [0]=>
35  array(3) {
36    [0]=>
37    int(311)
38    [1]=>
39    string(48) "
40<html>
41<body>
42  Testing HTML
43</body>
44</html>"
45
46"
47    [2]=>
48    int(1)
49  }
50  [1]=>
51  array(3) {
52    [0]=>
53    int(368)
54    [1]=>
55    string(6) "<?php "
56    [2]=>
57    int(8)
58  }
59  [2]=>
60  array(3) {
61    [0]=>
62    int(371)
63    [1]=>
64    string(3) "
65  "
66    [2]=>
67    int(8)
68  }
69  [3]=>
70  array(3) {
71    [0]=>
72    int(316)
73    [1]=>
74    string(4) "echo"
75    [2]=>
76    int(9)
77  }
78  [4]=>
79  array(3) {
80    [0]=>
81    int(371)
82    [1]=>
83    string(1) " "
84    [2]=>
85    int(9)
86  }
87  [5]=>
88  array(3) {
89    [0]=>
90    int(315)
91    [1]=>
92    string(20) ""php code with HTML""
93    [2]=>
94    int(9)
95  }
96  [6]=>
97  string(1) ";"
98  [7]=>
99  array(3) {
100    [0]=>
101    int(371)
102    [1]=>
103    string(1) "
104"
105    [2]=>
106    int(9)
107  }
108  [8]=>
109  array(3) {
110    [0]=>
111    int(370)
112    [1]=>
113    string(2) "?>"
114    [2]=>
115    int(10)
116  }
117}
118Done
119