3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(token_get_all('<?php "foo $bar"'));
based on jme1G
Output for 7.0.0 - 7.2.0
array(5) { [0]=> array(3) { [0]=> int(379) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> string(1) """ [2]=> array(3) { [0]=> int(322) [1]=> string(4) "foo " [2]=> int(1) } [3]=> array(3) { [0]=> int(320) [1]=> string(4) "$bar" [2]=> int(1) } [4]=> string(1) """ }
Output for 5.6.8 - 5.6.28
array(5) { [0]=> array(3) { [0]=> int(376) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> string(1) """ [2]=> array(3) { [0]=> int(317) [1]=> string(4) "foo " [2]=> int(1) } [3]=> array(3) { [0]=> int(312) [1]=> string(4) "$bar" [2]=> int(1) } [4]=> string(1) """ }
Output for 5.5.24 - 5.5.35
array(5) { [0]=> array(3) { [0]=> int(374) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> string(1) """ [2]=> array(3) { [0]=> int(315) [1]=> string(4) "foo " [2]=> int(1) } [3]=> array(3) { [0]=> int(310) [1]=> string(4) "$bar" [2]=> int(1) } [4]=> string(1) """ }
Output for 5.4.10 - 5.4.45
array(5) { [0]=> array(3) { [0]=> int(372) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> string(1) """ [2]=> array(3) { [0]=> int(314) [1]=> string(4) "foo " [2]=> int(1) } [3]=> array(3) { [0]=> int(309) [1]=> string(4) "$bar" [2]=> int(1) } [4]=> string(1) """ }
Output for 5.3.20 - 5.3.29
array(5) { [0]=> array(3) { [0]=> int(368) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> string(1) """ [2]=> array(3) { [0]=> int(314) [1]=> string(4) "foo " [2]=> int(1) } [3]=> array(3) { [0]=> int(309) [1]=> string(4) "$bar" [2]=> int(1) } [4]=> string(1) """ }