3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tokens = token_get_all(" <?php class Foo { function __halt_compiler(){} } (new Foo())->__halt_compiler(); not_html(); " ); 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; });
based on s6s44
Output for 5.4.12 - 7.2.6
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.3.22 - 5.3.29
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