3v4l.org

run code in 300+ PHP versions simultaneously
<?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.3.11, 4.4.0 - 4.4.9, 5.0.2 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
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 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 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

preferences:
242 ms | 417 KiB | 358 Q