3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = '<?php array( \'one\' => \'hello\', \'two\' => "hello", \'three\' => array(1,2,3), \'four\' => $asset->delete(), ); '; $string = '<?php array(); '; $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 aLY0J
Output for 4.3.10 - 4.4.9, 5.0.2 - 7.2.0
0 : T_OPEN_TAG => <?php 1 : T_ARRAY => array 2 : ( 3 : ) 4 : ; 5 : T_WHITESPACE =>
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/lnOq3 on line 19 T_OPEN_TAG => <?php Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/lnOq3 on line 22 PHP_EOL1 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/lnOq3 on line 19 T_ARRAY => array Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/lnOq3 on line 22 PHP_EOL2 : ( Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/lnOq3 on line 22 PHP_EOL3 : ) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/lnOq3 on line 22 PHP_EOL4 : ; Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/lnOq3 on line 22 PHP_EOL5 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/lnOq3 on line 19 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/lnOq3 on line 22 PHP_EOL