3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(token_get_all("<?php class{ function test() { return 1; } } "));
based on L4gLi
Output for 7.0.0 - 7.2.0
array(22) { [0]=> array(3) { [0]=> int(379) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(1) } [2]=> array(3) { [0]=> int(361) [1]=> string(5) "class" [2]=> int(2) } [3]=> string(1) "{" [4]=> array(3) { [0]=> int(382) [1]=> string(6) " " [2]=> int(2) } [5]=> array(3) { [0]=> int(346) [1]=> string(8) "function" [2]=> int(4) } [6]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(4) } [7]=> array(3) { [0]=> int(319) [1]=> string(4) "test" [2]=> int(4) } [8]=> string(1) "(" [9]=> string(1) ")" [10]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(4) } [11]=> string(1) "{" [12]=> array(3) { [0]=> int(382) [1]=> string(10) " " [2]=> int(4) } [13]=> array(3) { [0]=> int(348) [1]=> string(6) "return" [2]=> int(5) } [14]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(5) } [15]=> array(3) { [0]=> int(317) [1]=> string(1) "1" [2]=> int(5) } [16]=> string(1) ";" [17]=> array(3) { [0]=> int(382) [1]=> string(6) " " [2]=> int(5) } [18]=> string(1) "}" [19]=> array(3) { [0]=> int(382) [1]=> string(2) " " [2]=> int(6) } [20]=> string(1) "}" [21]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(7) } }
Output for 5.6.8 - 5.6.28
array(22) { [0]=> array(3) { [0]=> int(376) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(1) } [2]=> array(3) { [0]=> int(358) [1]=> string(5) "class" [2]=> int(2) } [3]=> string(1) "{" [4]=> array(3) { [0]=> int(379) [1]=> string(6) " " [2]=> int(2) } [5]=> array(3) { [0]=> int(337) [1]=> string(8) "function" [2]=> int(4) } [6]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(4) } [7]=> array(3) { [0]=> int(310) [1]=> string(4) "test" [2]=> int(4) } [8]=> string(1) "(" [9]=> string(1) ")" [10]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(4) } [11]=> string(1) "{" [12]=> array(3) { [0]=> int(379) [1]=> string(10) " " [2]=> int(4) } [13]=> array(3) { [0]=> int(339) [1]=> string(6) "return" [2]=> int(5) } [14]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(5) } [15]=> array(3) { [0]=> int(308) [1]=> string(1) "1" [2]=> int(5) } [16]=> string(1) ";" [17]=> array(3) { [0]=> int(379) [1]=> string(6) " " [2]=> int(5) } [18]=> string(1) "}" [19]=> array(3) { [0]=> int(379) [1]=> string(2) " " [2]=> int(6) } [20]=> string(1) "}" [21]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(7) } }
Output for 5.5.24 - 5.5.35
array(22) { [0]=> array(3) { [0]=> int(374) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(1) } [2]=> array(3) { [0]=> int(356) [1]=> string(5) "class" [2]=> int(2) } [3]=> string(1) "{" [4]=> array(3) { [0]=> int(377) [1]=> string(6) " " [2]=> int(2) } [5]=> array(3) { [0]=> int(335) [1]=> string(8) "function" [2]=> int(4) } [6]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(4) } [7]=> array(3) { [0]=> int(308) [1]=> string(4) "test" [2]=> int(4) } [8]=> string(1) "(" [9]=> string(1) ")" [10]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(4) } [11]=> string(1) "{" [12]=> array(3) { [0]=> int(377) [1]=> string(10) " " [2]=> int(4) } [13]=> array(3) { [0]=> int(337) [1]=> string(6) "return" [2]=> int(5) } [14]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(5) } [15]=> array(3) { [0]=> int(306) [1]=> string(1) "1" [2]=> int(5) } [16]=> string(1) ";" [17]=> array(3) { [0]=> int(377) [1]=> string(6) " " [2]=> int(5) } [18]=> string(1) "}" [19]=> array(3) { [0]=> int(377) [1]=> string(2) " " [2]=> int(6) } [20]=> string(1) "}" [21]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(7) } }
Output for 5.4.11 - 5.4.45
array(22) { [0]=> array(3) { [0]=> int(372) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(1) } [2]=> array(3) { [0]=> int(354) [1]=> string(5) "class" [2]=> int(2) } [3]=> string(1) "{" [4]=> array(3) { [0]=> int(375) [1]=> string(6) " " [2]=> int(2) } [5]=> array(3) { [0]=> int(334) [1]=> string(8) "function" [2]=> int(4) } [6]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(4) } [7]=> array(3) { [0]=> int(307) [1]=> string(4) "test" [2]=> int(4) } [8]=> string(1) "(" [9]=> string(1) ")" [10]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(4) } [11]=> string(1) "{" [12]=> array(3) { [0]=> int(375) [1]=> string(10) " " [2]=> int(4) } [13]=> array(3) { [0]=> int(336) [1]=> string(6) "return" [2]=> int(5) } [14]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(5) } [15]=> array(3) { [0]=> int(305) [1]=> string(1) "1" [2]=> int(5) } [16]=> string(1) ";" [17]=> array(3) { [0]=> int(375) [1]=> string(6) " " [2]=> int(5) } [18]=> string(1) "}" [19]=> array(3) { [0]=> int(375) [1]=> string(2) " " [2]=> int(6) } [20]=> string(1) "}" [21]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(7) } }
Output for 5.3.21 - 5.3.29
array(22) { [0]=> array(3) { [0]=> int(368) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(1) } [2]=> array(3) { [0]=> int(353) [1]=> string(5) "class" [2]=> int(2) } [3]=> string(1) "{" [4]=> array(3) { [0]=> int(371) [1]=> string(6) " " [2]=> int(2) } [5]=> array(3) { [0]=> int(334) [1]=> string(8) "function" [2]=> int(4) } [6]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(4) } [7]=> array(3) { [0]=> int(307) [1]=> string(4) "test" [2]=> int(4) } [8]=> string(1) "(" [9]=> string(1) ")" [10]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(4) } [11]=> string(1) "{" [12]=> array(3) { [0]=> int(371) [1]=> string(10) " " [2]=> int(4) } [13]=> array(3) { [0]=> int(336) [1]=> string(6) "return" [2]=> int(5) } [14]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(5) } [15]=> array(3) { [0]=> int(305) [1]=> string(1) "1" [2]=> int(5) } [16]=> string(1) ";" [17]=> array(3) { [0]=> int(371) [1]=> string(6) " " [2]=> int(5) } [18]=> string(1) "}" [19]=> array(3) { [0]=> int(371) [1]=> string(2) " " [2]=> int(6) } [20]=> string(1) "}" [21]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(7) } }