3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $code ='<?php function test($a) { echo $a; } $a = 10; test($a); ?>'; $tokens = token_get_all($code); print_r($tokens); foreach ($tokens as $row) { //echo token_name($row[0]), "\r\n"; }
Output for 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => 379 [1] => <?php [2] => 1 ) [1] => Array ( [0] => 346 [1] => function [2] => 2 ) [2] => Array ( [0] => 382 [1] => [2] => 2 ) [3] => Array ( [0] => 319 [1] => test [2] => 2 ) [4] => ( [5] => Array ( [0] => 320 [1] => $a [2] => 2 ) [6] => ) [7] => Array ( [0] => 382 [1] => [2] => 2 ) [8] => { [9] => Array ( [0] => 382 [1] => [2] => 2 ) [10] => Array ( [0] => 328 [1] => echo [2] => 3 ) [11] => Array ( [0] => 382 [1] => [2] => 3 ) [12] => Array ( [0] => 320 [1] => $a [2] => 3 ) [13] => ; [14] => Array ( [0] => 382 [1] => [2] => 3 ) [15] => } [16] => Array ( [0] => 382 [1] => [2] => 4 ) [17] => Array ( [0] => 320 [1] => $a [2] => 6 ) [18] => Array ( [0] => 382 [1] => [2] => 6 ) [19] => = [20] => Array ( [0] => 382 [1] => [2] => 6 ) [21] => Array ( [0] => 317 [1] => 10 [2] => 6 ) [22] => ; [23] => Array ( [0] => 382 [1] => [2] => 6 ) [24] => Array ( [0] => 319 [1] => test [2] => 7 ) [25] => ( [26] => Array ( [0] => 320 [1] => $a [2] => 7 ) [27] => ) [28] => ; [29] => Array ( [0] => 382 [1] => [2] => 7 ) [30] => Array ( [0] => 381 [1] => ?> [2] => 8 ) )
Output for 5.3.0 - 5.3.29, hhvm-3.10.0 - 3.12.0
Array ( [0] => Array ( [0] => 368 [1] => <?php [2] => 1 ) [1] => Array ( [0] => 334 [1] => function [2] => 2 ) [2] => Array ( [0] => 371 [1] => [2] => 2 ) [3] => Array ( [0] => 307 [1] => test [2] => 2 ) [4] => ( [5] => Array ( [0] => 309 [1] => $a [2] => 2 ) [6] => ) [7] => Array ( [0] => 371 [1] => [2] => 2 ) [8] => { [9] => Array ( [0] => 371 [1] => [2] => 2 ) [10] => Array ( [0] => 316 [1] => echo [2] => 3 ) [11] => Array ( [0] => 371 [1] => [2] => 3 ) [12] => Array ( [0] => 309 [1] => $a [2] => 3 ) [13] => ; [14] => Array ( [0] => 371 [1] => [2] => 3 ) [15] => } [16] => Array ( [0] => 371 [1] => [2] => 4 ) [17] => Array ( [0] => 309 [1] => $a [2] => 6 ) [18] => Array ( [0] => 371 [1] => [2] => 6 ) [19] => = [20] => Array ( [0] => 371 [1] => [2] => 6 ) [21] => Array ( [0] => 305 [1] => 10 [2] => 6 ) [22] => ; [23] => Array ( [0] => 371 [1] => [2] => 6 ) [24] => Array ( [0] => 307 [1] => test [2] => 7 ) [25] => ( [26] => Array ( [0] => 309 [1] => $a [2] => 7 ) [27] => ) [28] => ; [29] => Array ( [0] => 371 [1] => [2] => 7 ) [30] => Array ( [0] => 370 [1] => ?> [2] => 8 ) )
Output for 5.6.7 - 5.6.28
Array ( [0] => Array ( [0] => 376 [1] => <?php [2] => 1 ) [1] => Array ( [0] => 337 [1] => function [2] => 2 ) [2] => Array ( [0] => 379 [1] => [2] => 2 ) [3] => Array ( [0] => 310 [1] => test [2] => 2 ) [4] => ( [5] => Array ( [0] => 312 [1] => $a [2] => 2 ) [6] => ) [7] => Array ( [0] => 379 [1] => [2] => 2 ) [8] => { [9] => Array ( [0] => 379 [1] => [2] => 2 ) [10] => Array ( [0] => 319 [1] => echo [2] => 3 ) [11] => Array ( [0] => 379 [1] => [2] => 3 ) [12] => Array ( [0] => 312 [1] => $a [2] => 3 ) [13] => ; [14] => Array ( [0] => 379 [1] => [2] => 3 ) [15] => } [16] => Array ( [0] => 379 [1] => [2] => 4 ) [17] => Array ( [0] => 312 [1] => $a [2] => 6 ) [18] => Array ( [0] => 379 [1] => [2] => 6 ) [19] => = [20] => Array ( [0] => 379 [1] => [2] => 6 ) [21] => Array ( [0] => 308 [1] => 10 [2] => 6 ) [22] => ; [23] => Array ( [0] => 379 [1] => [2] => 6 ) [24] => Array ( [0] => 310 [1] => test [2] => 7 ) [25] => ( [26] => Array ( [0] => 312 [1] => $a [2] => 7 ) [27] => ) [28] => ; [29] => Array ( [0] => 379 [1] => [2] => 7 ) [30] => Array ( [0] => 378 [1] => ?> [2] => 8 ) )
Output for 5.5.24 - 5.5.35
Array ( [0] => Array ( [0] => 374 [1] => <?php [2] => 1 ) [1] => Array ( [0] => 335 [1] => function [2] => 2 ) [2] => Array ( [0] => 377 [1] => [2] => 2 ) [3] => Array ( [0] => 308 [1] => test [2] => 2 ) [4] => ( [5] => Array ( [0] => 310 [1] => $a [2] => 2 ) [6] => ) [7] => Array ( [0] => 377 [1] => [2] => 2 ) [8] => { [9] => Array ( [0] => 377 [1] => [2] => 2 ) [10] => Array ( [0] => 317 [1] => echo [2] => 3 ) [11] => Array ( [0] => 377 [1] => [2] => 3 ) [12] => Array ( [0] => 310 [1] => $a [2] => 3 ) [13] => ; [14] => Array ( [0] => 377 [1] => [2] => 3 ) [15] => } [16] => Array ( [0] => 377 [1] => [2] => 4 ) [17] => Array ( [0] => 310 [1] => $a [2] => 6 ) [18] => Array ( [0] => 377 [1] => [2] => 6 ) [19] => = [20] => Array ( [0] => 377 [1] => [2] => 6 ) [21] => Array ( [0] => 306 [1] => 10 [2] => 6 ) [22] => ; [23] => Array ( [0] => 377 [1] => [2] => 6 ) [24] => Array ( [0] => 308 [1] => test [2] => 7 ) [25] => ( [26] => Array ( [0] => 310 [1] => $a [2] => 7 ) [27] => ) [28] => ; [29] => Array ( [0] => 377 [1] => [2] => 7 ) [30] => Array ( [0] => 376 [1] => ?> [2] => 8 ) )
Output for 5.4.0 - 5.4.45
Array ( [0] => Array ( [0] => 372 [1] => <?php [2] => 1 ) [1] => Array ( [0] => 334 [1] => function [2] => 2 ) [2] => Array ( [0] => 375 [1] => [2] => 2 ) [3] => Array ( [0] => 307 [1] => test [2] => 2 ) [4] => ( [5] => Array ( [0] => 309 [1] => $a [2] => 2 ) [6] => ) [7] => Array ( [0] => 375 [1] => [2] => 2 ) [8] => { [9] => Array ( [0] => 375 [1] => [2] => 2 ) [10] => Array ( [0] => 316 [1] => echo [2] => 3 ) [11] => Array ( [0] => 375 [1] => [2] => 3 ) [12] => Array ( [0] => 309 [1] => $a [2] => 3 ) [13] => ; [14] => Array ( [0] => 375 [1] => [2] => 3 ) [15] => } [16] => Array ( [0] => 375 [1] => [2] => 4 ) [17] => Array ( [0] => 309 [1] => $a [2] => 6 ) [18] => Array ( [0] => 375 [1] => [2] => 6 ) [19] => = [20] => Array ( [0] => 375 [1] => [2] => 6 ) [21] => Array ( [0] => 305 [1] => 10 [2] => 6 ) [22] => ; [23] => Array ( [0] => 375 [1] => [2] => 6 ) [24] => Array ( [0] => 307 [1] => test [2] => 7 ) [25] => ( [26] => Array ( [0] => 309 [1] => $a [2] => 7 ) [27] => ) [28] => ; [29] => Array ( [0] => 375 [1] => [2] => 7 ) [30] => Array ( [0] => 374 [1] => ?> [2] => 8 ) )
Output for 5.2.2 - 5.2.17
Array ( [0] => Array ( [0] => 367 [1] => <?php [2] => 1 ) [1] => Array ( [0] => 333 [1] => function [2] => 2 ) [2] => Array ( [0] => 370 [1] => [2] => 2 ) [3] => Array ( [0] => 307 [1] => test [2] => 2 ) [4] => ( [5] => Array ( [0] => 309 [1] => $a [2] => 2 ) [6] => ) [7] => Array ( [0] => 370 [1] => [2] => 2 ) [8] => { [9] => Array ( [0] => 370 [1] => [2] => 2 ) [10] => Array ( [0] => 316 [1] => echo [2] => 3 ) [11] => Array ( [0] => 370 [1] => [2] => 3 ) [12] => Array ( [0] => 309 [1] => $a [2] => 3 ) [13] => ; [14] => Array ( [0] => 370 [1] => [2] => 3 ) [15] => } [16] => Array ( [0] => 370 [1] => [2] => 4 ) [17] => Array ( [0] => 309 [1] => $a [2] => 6 ) [18] => Array ( [0] => 370 [1] => [2] => 6 ) [19] => = [20] => Array ( [0] => 370 [1] => [2] => 6 ) [21] => Array ( [0] => 305 [1] => 10 [2] => 6 ) [22] => ; [23] => Array ( [0] => 370 [1] => [2] => 6 ) [24] => Array ( [0] => 307 [1] => test [2] => 7 ) [25] => ( [26] => Array ( [0] => 309 [1] => $a [2] => 7 ) [27] => ) [28] => ; [29] => Array ( [0] => 370 [1] => [2] => 7 ) [30] => Array ( [0] => 369 [1] => ?> [2] => 8 ) )
Output for 5.1.0 - 5.2.1
Array ( [0] => Array ( [0] => 367 [1] => <?php ) [1] => Array ( [0] => 333 [1] => function ) [2] => Array ( [0] => 370 [1] => ) [3] => Array ( [0] => 307 [1] => test ) [4] => ( [5] => Array ( [0] => 309 [1] => $a ) [6] => ) [7] => Array ( [0] => 370 [1] => ) [8] => { [9] => Array ( [0] => 370 [1] => ) [10] => Array ( [0] => 316 [1] => echo ) [11] => Array ( [0] => 370 [1] => ) [12] => Array ( [0] => 309 [1] => $a ) [13] => ; [14] => Array ( [0] => 370 [1] => ) [15] => } [16] => Array ( [0] => 370 [1] => ) [17] => Array ( [0] => 309 [1] => $a ) [18] => Array ( [0] => 370 [1] => ) [19] => = [20] => Array ( [0] => 370 [1] => ) [21] => Array ( [0] => 305 [1] => 10 ) [22] => ; [23] => Array ( [0] => 370 [1] => ) [24] => Array ( [0] => 307 [1] => test ) [25] => ( [26] => Array ( [0] => 309 [1] => $a ) [27] => ) [28] => ; [29] => Array ( [0] => 370 [1] => ) [30] => Array ( [0] => 369 [1] => ?> ) )
Output for 5.0.0 - 5.0.5
Array ( [0] => Array ( [0] => 365 [1] => <?php ) [1] => Array ( [0] => 332 [1] => function ) [2] => Array ( [0] => 368 [1] => ) [3] => Array ( [0] => 306 [1] => test ) [4] => ( [5] => Array ( [0] => 308 [1] => $a ) [6] => ) [7] => Array ( [0] => 368 [1] => ) [8] => { [9] => Array ( [0] => 368 [1] => ) [10] => Array ( [0] => 315 [1] => echo ) [11] => Array ( [0] => 368 [1] => ) [12] => Array ( [0] => 308 [1] => $a ) [13] => ; [14] => Array ( [0] => 368 [1] => ) [15] => } [16] => Array ( [0] => 368 [1] => ) [17] => Array ( [0] => 308 [1] => $a ) [18] => Array ( [0] => 368 [1] => ) [19] => = [20] => Array ( [0] => 368 [1] => ) [21] => Array ( [0] => 304 [1] => 10 ) [22] => ; [23] => Array ( [0] => 368 [1] => ) [24] => Array ( [0] => 306 [1] => test ) [25] => ( [26] => Array ( [0] => 308 [1] => $a ) [27] => ) [28] => ; [29] => Array ( [0] => 368 [1] => ) [30] => Array ( [0] => 367 [1] => ?> ) )
Output for 4.4.2 - 4.4.9
Array ( [0] => Array ( [0] => 354 [1] => <?php ) [1] => Array ( [0] => 332 [1] => function ) [2] => Array ( [0] => 357 [1] => ) [3] => Array ( [0] => 305 [1] => test ) [4] => ( [5] => Array ( [0] => 307 [1] => $a ) [6] => ) [7] => Array ( [0] => 357 [1] => ) [8] => { [9] => Array ( [0] => 357 [1] => ) [10] => Array ( [0] => 314 [1] => echo ) [11] => Array ( [0] => 357 [1] => ) [12] => Array ( [0] => 307 [1] => $a ) [13] => ; [14] => Array ( [0] => 357 [1] => ) [15] => } [16] => Array ( [0] => 357 [1] => ) [17] => Array ( [0] => 307 [1] => $a ) [18] => Array ( [0] => 357 [1] => ) [19] => = [20] => Array ( [0] => 357 [1] => ) [21] => Array ( [0] => 303 [1] => 10 ) [22] => ; [23] => Array ( [0] => 357 [1] => ) [24] => Array ( [0] => 305 [1] => test ) [25] => ( [26] => Array ( [0] => 307 [1] => $a ) [27] => ) [28] => ; [29] => Array ( [0] => 357 [1] => ) [30] => Array ( [0] => 356 [1] => ?> ) )
Output for 4.3.0 - 4.4.1
Array ( [0] => Array ( [0] => 353 [1] => <?php ) [1] => Array ( [0] => 331 [1] => function ) [2] => Array ( [0] => 356 [1] => ) [3] => Array ( [0] => 304 [1] => test ) [4] => ( [5] => Array ( [0] => 306 [1] => $a ) [6] => ) [7] => Array ( [0] => 356 [1] => ) [8] => { [9] => Array ( [0] => 356 [1] => ) [10] => Array ( [0] => 313 [1] => echo ) [11] => Array ( [0] => 356 [1] => ) [12] => Array ( [0] => 306 [1] => $a ) [13] => ; [14] => Array ( [0] => 356 [1] => ) [15] => } [16] => Array ( [0] => 356 [1] => ) [17] => Array ( [0] => 306 [1] => $a ) [18] => Array ( [0] => 356 [1] => ) [19] => = [20] => Array ( [0] => 356 [1] => ) [21] => Array ( [0] => 302 [1] => 10 ) [22] => ; [23] => Array ( [0] => 356 [1] => ) [24] => Array ( [0] => 304 [1] => test ) [25] => ( [26] => Array ( [0] => 306 [1] => $a ) [27] => ) [28] => ; [29] => Array ( [0] => 356 [1] => ) [30] => Array ( [0] => 355 [1] => ?> ) )