3v4l.org

run code in 300+ PHP versions simultaneously
<?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; });
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.21, 8.3.0 - 8.3.9
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:
162.14 ms | 405 KiB | 188 Q