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