3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = PhpToken::tokenize('<?php echo 1;'); var_dump($result);
Output for 8.4.1 - 8.4.3
array(5) { [0]=> object(PhpToken)#1 (4) { ["id"]=> int(393) ["text"]=> string(6) "<?php " ["line"]=> int(1) ["pos"]=> int(0) } [1]=> object(PhpToken)#2 (4) { ["id"]=> int(291) ["text"]=> string(4) "echo" ["line"]=> int(1) ["pos"]=> int(6) } [2]=> object(PhpToken)#3 (4) { ["id"]=> int(396) ["text"]=> string(1) " " ["line"]=> int(1) ["pos"]=> int(10) } [3]=> object(PhpToken)#4 (4) { ["id"]=> int(260) ["text"]=> string(1) "1" ["line"]=> int(1) ["pos"]=> int(11) } [4]=> object(PhpToken)#5 (4) { ["id"]=> int(59) ["text"]=> string(1) ";" ["line"]=> int(1) ["pos"]=> int(12) } }
Output for 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.1, 8.3.3, 8.3.5 - 8.3.6, 8.3.8, 8.3.10, 8.3.12, 8.3.14, 8.3.16
array(5) { [0]=> object(PhpToken)#1 (4) { ["id"]=> int(389) ["text"]=> string(6) "<?php " ["line"]=> int(1) ["pos"]=> int(0) } [1]=> object(PhpToken)#2 (4) { ["id"]=> int(291) ["text"]=> string(4) "echo" ["line"]=> int(1) ["pos"]=> int(6) } [2]=> object(PhpToken)#3 (4) { ["id"]=> int(392) ["text"]=> string(1) " " ["line"]=> int(1) ["pos"]=> int(10) } [3]=> object(PhpToken)#4 (4) { ["id"]=> int(260) ["text"]=> string(1) "1" ["line"]=> int(1) ["pos"]=> int(11) } [4]=> object(PhpToken)#5 (4) { ["id"]=> int(59) ["text"]=> string(1) ";" ["line"]=> int(1) ["pos"]=> int(12) } }
Output for 8.3.0, 8.3.2, 8.3.4, 8.3.7, 8.3.9, 8.3.11, 8.3.13, 8.3.15
array(5) { [0]=> object(PhpToken)#1 (4) { ["id"]=> int(394) ["text"]=> string(6) "<?php " ["line"]=> int(1) ["pos"]=> int(0) } [1]=> object(PhpToken)#2 (4) { ["id"]=> int(328) ["text"]=> string(4) "echo" ["line"]=> int(1) ["pos"]=> int(6) } [2]=> object(PhpToken)#3 (4) { ["id"]=> int(397) ["text"]=> string(1) " " ["line"]=> int(1) ["pos"]=> int(10) } [3]=> object(PhpToken)#4 (4) { ["id"]=> int(311) ["text"]=> string(1) "1" ["line"]=> int(1) ["pos"]=> int(11) } [4]=> object(PhpToken)#5 (4) { ["id"]=> int(59) ["text"]=> string(1) ";" ["line"]=> int(1) ["pos"]=> int(12) } }
Output for 8.0.30
array(5) { [0]=> object(PhpToken)#1 (4) { ["id"]=> int(387) ["text"]=> string(6) "<?php " ["line"]=> int(1) ["pos"]=> int(0) } [1]=> object(PhpToken)#2 (4) { ["id"]=> int(291) ["text"]=> string(4) "echo" ["line"]=> int(1) ["pos"]=> int(6) } [2]=> object(PhpToken)#3 (4) { ["id"]=> int(390) ["text"]=> string(1) " " ["line"]=> int(1) ["pos"]=> int(10) } [3]=> object(PhpToken)#4 (4) { ["id"]=> int(260) ["text"]=> string(1) "1" ["line"]=> int(1) ["pos"]=> int(11) } [4]=> object(PhpToken)#5 (4) { ["id"]=> int(59) ["text"]=> string(1) ";" ["line"]=> int(1) ["pos"]=> int(12) } }
Output for 8.0.1 - 8.0.29
array(5) { [0]=> object(PhpToken)#1 (4) { ["id"]=> int(390) ["text"]=> string(6) "<?php " ["line"]=> int(1) ["pos"]=> int(0) } [1]=> object(PhpToken)#2 (4) { ["id"]=> int(326) ["text"]=> string(4) "echo" ["line"]=> int(1) ["pos"]=> int(6) } [2]=> object(PhpToken)#3 (4) { ["id"]=> int(393) ["text"]=> string(1) " " ["line"]=> int(1) ["pos"]=> int(10) } [3]=> object(PhpToken)#4 (4) { ["id"]=> int(309) ["text"]=> string(1) "1" ["line"]=> int(1) ["pos"]=> int(11) } [4]=> object(PhpToken)#5 (4) { ["id"]=> int(59) ["text"]=> string(1) ";" ["line"]=> int(1) ["pos"]=> int(12) } }
Output for 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Class 'PhpToken' not found in /in/JJp4v:3 Stack trace: #0 {main} thrown in /in/JJp4v on line 3
Process exited with code 255.

preferences:
106.98 ms | 416 KiB | 5 Q