3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = '<?php array( \'one\' => \'hello\', \'two\' => "hello", \'three\' => array(1,2,3), ); '; $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; }
Output for 4.3.10 - 4.4.9, 5.0.2 - 7.2.0
0 : T_OPEN_TAG => <?php\n 1 : T_WHITESPACE => \n 2 : T_ARRAY => array 3 : ( 4 : T_WHITESPACE => \n 5 : T_CONSTANT_ENCAPSED_STRING => 'one' 6 : T_WHITESPACE => 7 : T_DOUBLE_ARROW => => 8 : T_WHITESPACE => 9 : T_CONSTANT_ENCAPSED_STRING => 'hello' 10 : , 11 : T_WHITESPACE => 12 : T_CONSTANT_ENCAPSED_STRING => 'two' 13 : T_WHITESPACE => 14 : T_DOUBLE_ARROW => => 15 : T_WHITESPACE => 16 : T_CONSTANT_ENCAPSED_STRING => "hello" 17 : , 18 : T_WHITESPACE => \n 19 : T_CONSTANT_ENCAPSED_STRING => 'three' 20 : T_WHITESPACE => 21 : T_DOUBLE_ARROW => => 22 : T_WHITESPACE => 23 : T_ARRAY => array 24 : ( 25 : T_LNUMBER => 1 26 : , 27 : T_LNUMBER => 2 28 : , 29 : T_LNUMBER => 3 30 : ) 31 : , 32 : T_WHITESPACE => \n 33 : ) 34 : ; 35 : T_WHITESPACE => \n
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/VEdGA on line 17 T_OPEN_TAG => <?php Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL1 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL2 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_ARRAY => array Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL3 : ( Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL4 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL5 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_CONSTANT_ENCAPSED_STRING => 'one' Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL6 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL7 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_DOUBLE_ARROW => => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL8 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL9 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_CONSTANT_ENCAPSED_STRING => 'hello' Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL10 : , Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL11 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL12 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_CONSTANT_ENCAPSED_STRING => 'two' Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL13 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL14 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_DOUBLE_ARROW => => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL15 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL16 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_CONSTANT_ENCAPSED_STRING => "hello" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL17 : , Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL18 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL19 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_CONSTANT_ENCAPSED_STRING => 'three' Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL20 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL21 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_DOUBLE_ARROW => => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL22 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL23 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_ARRAY => array Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL24 : ( Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL25 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_LNUMBER => 1 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL26 : , Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL27 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_LNUMBER => 2 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL28 : , Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL29 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_LNUMBER => 3 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL30 : ) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL31 : , Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL32 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL33 : ) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL34 : ; Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL35 : Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 17 T_WHITESPACE => Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VEdGA on line 20 PHP_EOL