3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $php = <<<'EOT' some html <?php // Inline /** * Comment */ class C { function foo(T $t) {} } EOT; print_r(token_get_all($php));
based on eZ2eY
Output for 7.0.0 - 7.2.0
Array ( [0] => Array ( [0] => 321 [1] => some html [2] => 1 ) [1] => Array ( [0] => 379 [1] => <?php [2] => 4 ) [2] => Array ( [0] => 377 [1] => // Inline [2] => 5 ) [3] => Array ( [0] => 382 [1] => [2] => 6 ) [4] => Array ( [0] => 378 [1] => /** * Comment */ [2] => 7 ) [5] => Array ( [0] => 382 [1] => [2] => 9 ) [6] => Array ( [0] => 361 [1] => class [2] => 10 ) [7] => Array ( [0] => 382 [1] => [2] => 10 ) [8] => Array ( [0] => 319 [1] => C [2] => 10 ) [9] => Array ( [0] => 382 [1] => [2] => 10 ) [10] => { [11] => Array ( [0] => 382 [1] => [2] => 10 ) [12] => Array ( [0] => 346 [1] => function [2] => 11 ) [13] => Array ( [0] => 382 [1] => [2] => 11 ) [14] => Array ( [0] => 319 [1] => foo [2] => 11 ) [15] => ( [16] => Array ( [0] => 319 [1] => T [2] => 11 ) [17] => Array ( [0] => 382 [1] => [2] => 11 ) [18] => Array ( [0] => 320 [1] => $t [2] => 11 ) [19] => ) [20] => Array ( [0] => 382 [1] => [2] => 11 ) [21] => { [22] => } [23] => Array ( [0] => 382 [1] => [2] => 11 ) [24] => } )
Output for 5.6.8 - 5.6.28
Array ( [0] => Array ( [0] => 314 [1] => some html [2] => 1 ) [1] => Array ( [0] => 376 [1] => <?php [2] => 4 ) [2] => Array ( [0] => 374 [1] => // Inline [2] => 5 ) [3] => Array ( [0] => 379 [1] => [2] => 6 ) [4] => Array ( [0] => 375 [1] => /** * Comment */ [2] => 7 ) [5] => Array ( [0] => 379 [1] => [2] => 9 ) [6] => Array ( [0] => 358 [1] => class [2] => 10 ) [7] => Array ( [0] => 379 [1] => [2] => 10 ) [8] => Array ( [0] => 310 [1] => C [2] => 10 ) [9] => Array ( [0] => 379 [1] => [2] => 10 ) [10] => { [11] => Array ( [0] => 379 [1] => [2] => 10 ) [12] => Array ( [0] => 337 [1] => function [2] => 11 ) [13] => Array ( [0] => 379 [1] => [2] => 11 ) [14] => Array ( [0] => 310 [1] => foo [2] => 11 ) [15] => ( [16] => Array ( [0] => 310 [1] => T [2] => 11 ) [17] => Array ( [0] => 379 [1] => [2] => 11 ) [18] => Array ( [0] => 312 [1] => $t [2] => 11 ) [19] => ) [20] => Array ( [0] => 379 [1] => [2] => 11 ) [21] => { [22] => } [23] => Array ( [0] => 379 [1] => [2] => 11 ) [24] => } )
Output for 5.5.24 - 5.5.35
Array ( [0] => Array ( [0] => 312 [1] => some html [2] => 1 ) [1] => Array ( [0] => 374 [1] => <?php [2] => 4 ) [2] => Array ( [0] => 372 [1] => // Inline [2] => 5 ) [3] => Array ( [0] => 377 [1] => [2] => 6 ) [4] => Array ( [0] => 373 [1] => /** * Comment */ [2] => 7 ) [5] => Array ( [0] => 377 [1] => [2] => 9 ) [6] => Array ( [0] => 356 [1] => class [2] => 10 ) [7] => Array ( [0] => 377 [1] => [2] => 10 ) [8] => Array ( [0] => 308 [1] => C [2] => 10 ) [9] => Array ( [0] => 377 [1] => [2] => 10 ) [10] => { [11] => Array ( [0] => 377 [1] => [2] => 10 ) [12] => Array ( [0] => 335 [1] => function [2] => 11 ) [13] => Array ( [0] => 377 [1] => [2] => 11 ) [14] => Array ( [0] => 308 [1] => foo [2] => 11 ) [15] => ( [16] => Array ( [0] => 308 [1] => T [2] => 11 ) [17] => Array ( [0] => 377 [1] => [2] => 11 ) [18] => Array ( [0] => 310 [1] => $t [2] => 11 ) [19] => ) [20] => Array ( [0] => 377 [1] => [2] => 11 ) [21] => { [22] => } [23] => Array ( [0] => 377 [1] => [2] => 11 ) [24] => } )
Output for 5.4.10 - 5.4.45
Array ( [0] => Array ( [0] => 311 [1] => some html [2] => 1 ) [1] => Array ( [0] => 372 [1] => <?php [2] => 4 ) [2] => Array ( [0] => 370 [1] => // Inline [2] => 5 ) [3] => Array ( [0] => 375 [1] => [2] => 6 ) [4] => Array ( [0] => 371 [1] => /** * Comment */ [2] => 7 ) [5] => Array ( [0] => 375 [1] => [2] => 9 ) [6] => Array ( [0] => 354 [1] => class [2] => 10 ) [7] => Array ( [0] => 375 [1] => [2] => 10 ) [8] => Array ( [0] => 307 [1] => C [2] => 10 ) [9] => Array ( [0] => 375 [1] => [2] => 10 ) [10] => { [11] => Array ( [0] => 375 [1] => [2] => 10 ) [12] => Array ( [0] => 334 [1] => function [2] => 11 ) [13] => Array ( [0] => 375 [1] => [2] => 11 ) [14] => Array ( [0] => 307 [1] => foo [2] => 11 ) [15] => ( [16] => Array ( [0] => 307 [1] => T [2] => 11 ) [17] => Array ( [0] => 375 [1] => [2] => 11 ) [18] => Array ( [0] => 309 [1] => $t [2] => 11 ) [19] => ) [20] => Array ( [0] => 375 [1] => [2] => 11 ) [21] => { [22] => } [23] => Array ( [0] => 375 [1] => [2] => 11 ) [24] => } )
Output for 5.3.20 - 5.3.29
Array ( [0] => Array ( [0] => 311 [1] => some html [2] => 1 ) [1] => Array ( [0] => 368 [1] => <?php [2] => 4 ) [2] => Array ( [0] => 366 [1] => // Inline [2] => 5 ) [3] => Array ( [0] => 371 [1] => [2] => 6 ) [4] => Array ( [0] => 367 [1] => /** * Comment */ [2] => 7 ) [5] => Array ( [0] => 371 [1] => [2] => 9 ) [6] => Array ( [0] => 353 [1] => class [2] => 10 ) [7] => Array ( [0] => 371 [1] => [2] => 10 ) [8] => Array ( [0] => 307 [1] => C [2] => 10 ) [9] => Array ( [0] => 371 [1] => [2] => 10 ) [10] => { [11] => Array ( [0] => 371 [1] => [2] => 10 ) [12] => Array ( [0] => 334 [1] => function [2] => 11 ) [13] => Array ( [0] => 371 [1] => [2] => 11 ) [14] => Array ( [0] => 307 [1] => foo [2] => 11 ) [15] => ( [16] => Array ( [0] => 307 [1] => T [2] => 11 ) [17] => Array ( [0] => 371 [1] => [2] => 11 ) [18] => Array ( [0] => 309 [1] => $t [2] => 11 ) [19] => ) [20] => Array ( [0] => 371 [1] => [2] => 11 ) [21] => { [22] => } [23] => Array ( [0] => 371 [1] => [2] => 11 ) [24] => } )