3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = '<?php dsfdsf'; $tokens = token_get_all($string); foreach ($tokens as $i => $token) { echo "$i : "; if (is_array($token) === false) { echo $token; } else { echo token_name($token[0]).' => '.str_replace(PHP_EOL, '\n', $token[1]); } echo PHP_EOL; }
based on MgA9d
Output for 4.3.10 - 4.4.9, 5.0.2 - 7.3.0rc4
0 : T_OPEN_TAG => <?php\n 1 : T_WHITESPACE => \n 2 : T_STRING => dsfdsf
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
0 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/FH7kD on line 13 T_OPEN_TAG => <?php Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/FH7kD on line 16 PHP_EOL1 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/FH7kD on line 13 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/FH7kD on line 16 PHP_EOL2 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/FH7kD on line 13 T_STRING => dsfdsf Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/FH7kD on line 16 PHP_EOL