<?php
$tokens = token_get_all("
<?php
class Foo {
function __halt_compiler(){}
}
(new Foo())->__halt_compiler();
not_html();
"
);
var_dump($tokens);
array_walk($tokens, function($tk) {
if(is_array($tk)) {
if(($t = token_name($tk[0])) == 'T_WHITESPACE') return;
echo "L{$tk[2]}: ".$t." {$tk[1]}", PHP_EOL;
}
else echo $tk, PHP_EOL;
});
- Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.1, 8.3.3, 8.3.5 - 8.3.6
- array(16) {
[0]=>
array(3) {
[0]=>
int(267)
[1]=>
string(1) "
"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(389)
[1]=>
string(6) "<?php
"
[2]=>
int(2)
}
[2]=>
array(3) {
[0]=>
int(392)
[1]=>
string(1) "
"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(333)
[1]=>
string(5) "class"
[2]=>
int(4)
}
[4]=>
array(3) {
[0]=>
int(392)
[1]=>
string(1) " "
[2]=>
int(4)
}
[5]=>
array(3) {
[0]=>
int(262)
[1]=>
string(3) "Foo"
[2]=>
int(4)
}
[6]=>
array(3) {
[0]=>
int(392)
[1]=>
string(1) " "
[2]=>
int(4)
}
[7]=>
string(1) "{"
[8]=>
array(3) {
[0]=>
int(392)
[1]=>
string(5) "
"
[2]=>
int(4)
}
[9]=>
array(3) {
[0]=>
int(310)
[1]=>
string(8) "function"
[2]=>
int(5)
}
[10]=>
array(3) {
[0]=>
int(392)
[1]=>
string(1) " "
[2]=>
int(5)
}
[11]=>
array(3) {
[0]=>
int(332)
[1]=>
string(15) "__halt_compiler"
[2]=>
int(5)
}
[12]=>
string(1) "("
[13]=>
string(1) ")"
[14]=>
string(1) "{"
[15]=>
array(3) {
[0]=>
int(267)
[1]=>
string(51) "}
}
(new Foo())->__halt_compiler();
not_html();
"
[2]=>
int(5)
}
}
L1: T_INLINE_HTML
L2: T_OPEN_TAG <?php
L4: T_CLASS class
L4: T_STRING Foo
{
L5: T_FUNCTION function
L5: T_HALT_COMPILER __halt_compiler
(
)
{
L5: T_INLINE_HTML }
}
(new Foo())->__halt_compiler();
not_html();
- Output for 8.3.0, 8.3.2, 8.3.4
- array(16) {
[0]=>
array(3) {
[0]=>
int(318)
[1]=>
string(1) "
"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(394)
[1]=>
string(6) "<?php
"
[2]=>
int(2)
}
[2]=>
array(3) {
[0]=>
int(397)
[1]=>
string(1) "
"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(369)
[1]=>
string(5) "class"
[2]=>
int(4)
}
[4]=>
array(3) {
[0]=>
int(397)
[1]=>
string(1) " "
[2]=>
int(4)
}
[5]=>
array(3) {
[0]=>
int(313)
[1]=>
string(3) "Foo"
[2]=>
int(4)
}
[6]=>
array(3) {
[0]=>
int(397)
[1]=>
string(1) " "
[2]=>
int(4)
}
[7]=>
string(1) "{"
[8]=>
array(3) {
[0]=>
int(397)
[1]=>
string(5) "
"
[2]=>
int(4)
}
[9]=>
array(3) {
[0]=>
int(347)
[1]=>
string(8) "function"
[2]=>
int(5)
}
[10]=>
array(3) {
[0]=>
int(397)
[1]=>
string(1) " "
[2]=>
int(5)
}
[11]=>
array(3) {
[0]=>
int(368)
[1]=>
string(15) "__halt_compiler"
[2]=>
int(5)
}
[12]=>
string(1) "("
[13]=>
string(1) ")"
[14]=>
string(1) "{"
[15]=>
array(3) {
[0]=>
int(318)
[1]=>
string(51) "}
}
(new Foo())->__halt_compiler();
not_html();
"
[2]=>
int(5)
}
}
L1: T_INLINE_HTML
L2: T_OPEN_TAG <?php
L4: T_CLASS class
L4: T_STRING Foo
{
L5: T_FUNCTION function
L5: T_HALT_COMPILER __halt_compiler
(
)
{
L5: T_INLINE_HTML }
}
(new Foo())->__halt_compiler();
not_html();
- Output for 8.0.30
- array(16) {
[0]=>
array(3) {
[0]=>
int(267)
[1]=>
string(1) "
"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(387)
[1]=>
string(6) "<?php
"
[2]=>
int(2)
}
[2]=>
array(3) {
[0]=>
int(390)
[1]=>
string(1) "
"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(332)
[1]=>
string(5) "class"
[2]=>
int(4)
}
[4]=>
array(3) {
[0]=>
int(390)
[1]=>
string(1) " "
[2]=>
int(4)
}
[5]=>
array(3) {
[0]=>
int(262)
[1]=>
string(3) "Foo"
[2]=>
int(4)
}
[6]=>
array(3) {
[0]=>
int(390)
[1]=>
string(1) " "
[2]=>
int(4)
}
[7]=>
string(1) "{"
[8]=>
array(3) {
[0]=>
int(390)
[1]=>
string(5) "
"
[2]=>
int(4)
}
[9]=>
array(3) {
[0]=>
int(310)
[1]=>
string(8) "function"
[2]=>
int(5)
}
[10]=>
array(3) {
[0]=>
int(390)
[1]=>
string(1) " "
[2]=>
int(5)
}
[11]=>
array(3) {
[0]=>
int(331)
[1]=>
string(15) "__halt_compiler"
[2]=>
int(5)
}
[12]=>
string(1) "("
[13]=>
string(1) ")"
[14]=>
string(1) "{"
[15]=>
array(3) {
[0]=>
int(267)
[1]=>
string(51) "}
}
(new Foo())->__halt_compiler();
not_html();
"
[2]=>
int(5)
}
}
L1: T_INLINE_HTML
L2: T_OPEN_TAG <?php
L4: T_CLASS class
L4: T_STRING Foo
{
L5: T_FUNCTION function
L5: T_HALT_COMPILER __halt_compiler
(
)
{
L5: T_INLINE_HTML }
}
(new Foo())->__halt_compiler();
not_html();
- Output for 8.0.0 - 8.0.29
- array(16) {
[0]=>
array(3) {
[0]=>
int(316)
[1]=>
string(1) "
"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(390)
[1]=>
string(6) "<?php
"
[2]=>
int(2)
}
[2]=>
array(3) {
[0]=>
int(393)
[1]=>
string(1) "
"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(366)
[1]=>
string(5) "class"
[2]=>
int(4)
}
[4]=>
array(3) {
[0]=>
int(393)
[1]=>
string(1) " "
[2]=>
int(4)
}
[5]=>
array(3) {
[0]=>
int(311)
[1]=>
string(3) "Foo"
[2]=>
int(4)
}
[6]=>
array(3) {
[0]=>
int(393)
[1]=>
string(1) " "
[2]=>
int(4)
}
[7]=>
string(1) "{"
[8]=>
array(3) {
[0]=>
int(393)
[1]=>
string(5) "
"
[2]=>
int(4)
}
[9]=>
array(3) {
[0]=>
int(345)
[1]=>
string(8) "function"
[2]=>
int(5)
}
[10]=>
array(3) {
[0]=>
int(393)
[1]=>
string(1) " "
[2]=>
int(5)
}
[11]=>
array(3) {
[0]=>
int(365)
[1]=>
string(15) "__halt_compiler"
[2]=>
int(5)
}
[12]=>
string(1) "("
[13]=>
string(1) ")"
[14]=>
string(1) "{"
[15]=>
array(3) {
[0]=>
int(316)
[1]=>
string(51) "}
}
(new Foo())->__halt_compiler();
not_html();
"
[2]=>
int(5)
}
}
L1: T_INLINE_HTML
L2: T_OPEN_TAG <?php
L4: T_CLASS class
L4: T_STRING Foo
{
L5: T_FUNCTION function
L5: T_HALT_COMPILER __halt_compiler
(
)
{
L5: T_INLINE_HTML }
}
(new Foo())->__halt_compiler();
not_html();
- Output for 7.4.0 - 7.4.33
- array(16) {
[0]=>
array(3) {
[0]=>
int(313)
[1]=>
string(1) "
"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(382)
[1]=>
string(6) "<?php
"
[2]=>
int(2)
}
[2]=>
array(3) {
[0]=>
int(385)
[1]=>
string(1) "
"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(364)
[1]=>
string(5) "class"
[2]=>
int(4)
}
[4]=>
array(3) {
[0]=>
int(385)
[1]=>
string(1) " "
[2]=>
int(4)
}
[5]=>
array(3) {
[0]=>
int(311)
[1]=>
string(3) "Foo"
[2]=>
int(4)
}
[6]=>
array(3) {
[0]=>
int(385)
[1]=>
string(1) " "
[2]=>
int(4)
}
[7]=>
string(1) "{"
[8]=>
array(3) {
[0]=>
int(385)
[1]=>
string(5) "
"
[2]=>
int(4)
}
[9]=>
array(3) {
[0]=>
int(342)
[1]=>
string(8) "function"
[2]=>
int(5)
}
[10]=>
array(3) {
[0]=>
int(385)
[1]=>
string(1) " "
[2]=>
int(5)
}
[11]=>
array(3) {
[0]=>
int(363)
[1]=>
string(15) "__halt_compiler"
[2]=>
int(5)
}
[12]=>
string(1) "("
[13]=>
string(1) ")"
[14]=>
string(1) "{"
[15]=>
array(3) {
[0]=>
int(313)
[1]=>
string(51) "}
}
(new Foo())->__halt_compiler();
not_html();
"
[2]=>
int(5)
}
}
L1: T_INLINE_HTML
L2: T_OPEN_TAG <?php
L4: T_CLASS class
L4: T_STRING Foo
{
L5: T_FUNCTION function
L5: T_HALT_COMPILER __halt_compiler
(
)
{
L5: T_INLINE_HTML }
}
(new Foo())->__halt_compiler();
not_html();
- Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
- array(16) {
[0]=>
array(3) {
[0]=>
int(321)
[1]=>
string(1) "
"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(379)
[1]=>
string(6) "<?php
"
[2]=>
int(2)
}
[2]=>
array(3) {
[0]=>
int(382)
[1]=>
string(1) "
"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(361)
[1]=>
string(5) "class"
[2]=>
int(4)
}
[4]=>
array(3) {
[0]=>
int(382)
[1]=>
string(1) " "
[2]=>
int(4)
}
[5]=>
array(3) {
[0]=>
int(319)
[1]=>
string(3) "Foo"
[2]=>
int(4)
}
[6]=>
array(3) {
[0]=>
int(382)
[1]=>
string(1) " "
[2]=>
int(4)
}
[7]=>
string(1) "{"
[8]=>
array(3) {
[0]=>
int(382)
[1]=>
string(5) "
"
[2]=>
int(4)
}
[9]=>
array(3) {
[0]=>
int(346)
[1]=>
string(8) "function"
[2]=>
int(5)
}
[10]=>
array(3) {
[0]=>
int(382)
[1]=>
string(1) " "
[2]=>
int(5)
}
[11]=>
array(3) {
[0]=>
int(360)
[1]=>
string(15) "__halt_compiler"
[2]=>
int(5)
}
[12]=>
string(1) "("
[13]=>
string(1) ")"
[14]=>
string(1) "{"
[15]=>
array(3) {
[0]=>
int(321)
[1]=>
string(51) "}
}
(new Foo())->__halt_compiler();
not_html();
"
[2]=>
int(5)
}
}
L1: T_INLINE_HTML
L2: T_OPEN_TAG <?php
L4: T_CLASS class
L4: T_STRING Foo
{
L5: T_FUNCTION function
L5: T_HALT_COMPILER __halt_compiler
(
)
{
L5: T_INLINE_HTML }
}
(new Foo())->__halt_compiler();
not_html();
- Output for 5.6.0 - 5.6.40
- array(16) {
[0]=>
array(3) {
[0]=>
int(314)
[1]=>
string(1) "
"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(376)
[1]=>
string(6) "<?php
"
[2]=>
int(2)
}
[2]=>
array(3) {
[0]=>
int(379)
[1]=>
string(1) "
"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(358)
[1]=>
string(5) "class"
[2]=>
int(4)
}
[4]=>
array(3) {
[0]=>
int(379)
[1]=>
string(1) " "
[2]=>
int(4)
}
[5]=>
array(3) {
[0]=>
int(310)
[1]=>
string(3) "Foo"
[2]=>
int(4)
}
[6]=>
array(3) {
[0]=>
int(379)
[1]=>
string(1) " "
[2]=>
int(4)
}
[7]=>
string(1) "{"
[8]=>
array(3) {
[0]=>
int(379)
[1]=>
string(5) "
"
[2]=>
int(4)
}
[9]=>
array(3) {
[0]=>
int(337)
[1]=>
string(8) "function"
[2]=>
int(5)
}
[10]=>
array(3) {
[0]=>
int(379)
[1]=>
string(1) " "
[2]=>
int(5)
}
[11]=>
array(3) {
[0]=>
int(357)
[1]=>
string(15) "__halt_compiler"
[2]=>
int(5)
}
[12]=>
string(1) "("
[13]=>
string(1) ")"
[14]=>
string(1) "{"
[15]=>
array(3) {
[0]=>
int(314)
[1]=>
string(51) "}
}
(new Foo())->__halt_compiler();
not_html();
"
[2]=>
int(5)
}
}
L1: T_INLINE_HTML
L2: T_OPEN_TAG <?php
L4: T_CLASS class
L4: T_STRING Foo
{
L5: T_FUNCTION function
L5: T_HALT_COMPILER __halt_compiler
(
)
{
L5: T_INLINE_HTML }
}
(new Foo())->__halt_compiler();
not_html();
- Output for 5.5.0 - 5.5.38
- array(16) {
[0]=>
array(3) {
[0]=>
int(312)
[1]=>
string(1) "
"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(374)
[1]=>
string(6) "<?php
"
[2]=>
int(2)
}
[2]=>
array(3) {
[0]=>
int(377)
[1]=>
string(1) "
"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(356)
[1]=>
string(5) "class"
[2]=>
int(4)
}
[4]=>
array(3) {
[0]=>
int(377)
[1]=>
string(1) " "
[2]=>
int(4)
}
[5]=>
array(3) {
[0]=>
int(308)
[1]=>
string(3) "Foo"
[2]=>
int(4)
}
[6]=>
array(3) {
[0]=>
int(377)
[1]=>
string(1) " "
[2]=>
int(4)
}
[7]=>
string(1) "{"
[8]=>
array(3) {
[0]=>
int(377)
[1]=>
string(5) "
"
[2]=>
int(4)
}
[9]=>
array(3) {
[0]=>
int(335)
[1]=>
string(8) "function"
[2]=>
int(5)
}
[10]=>
array(3) {
[0]=>
int(377)
[1]=>
string(1) " "
[2]=>
int(5)
}
[11]=>
array(3) {
[0]=>
int(355)
[1]=>
string(15) "__halt_compiler"
[2]=>
int(5)
}
[12]=>
string(1) "("
[13]=>
string(1) ")"
[14]=>
string(1) "{"
[15]=>
array(3) {
[0]=>
int(312)
[1]=>
string(51) "}
}
(new Foo())->__halt_compiler();
not_html();
"
[2]=>
int(5)
}
}
L1: T_INLINE_HTML
L2: T_OPEN_TAG <?php
L4: T_CLASS class
L4: T_STRING Foo
{
L5: T_FUNCTION function
L5: T_HALT_COMPILER __halt_compiler
(
)
{
L5: T_INLINE_HTML }
}
(new Foo())->__halt_compiler();
not_html();
preferences:
245.13 ms | 405 KiB | 327 Q