3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $nowdoc = <<<'TEST' class test { public function myfunc() { echo "hi mom"; } } TEST; $tokens = token_get_all("<?php ". $nowdoc); var_dump($tokens);
Output for 7.0.0 - 7.1.0
array(26) { [0]=> array(3) { [0]=> int(379) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(382) [1]=> string(4) " " [2]=> int(1) } [2]=> array(3) { [0]=> int(361) [1]=> string(5) "class" [2]=> int(1) } [3]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(1) } [4]=> array(3) { [0]=> int(319) [1]=> string(4) "test" [2]=> int(1) } [5]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(1) } [6]=> string(1) "{" [7]=> array(3) { [0]=> int(382) [1]=> string(9) " " [2]=> int(1) } [8]=> array(3) { [0]=> int(316) [1]=> string(6) "public" [2]=> int(2) } [9]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(2) } [10]=> array(3) { [0]=> int(346) [1]=> string(8) "function" [2]=> int(2) } [11]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(2) } [12]=> array(3) { [0]=> int(319) [1]=> string(6) "myfunc" [2]=> int(2) } [13]=> string(1) "(" [14]=> string(1) ")" [15]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(2) } [16]=> string(1) "{" [17]=> array(3) { [0]=> int(382) [1]=> string(13) " " [2]=> int(2) } [18]=> array(3) { [0]=> int(328) [1]=> string(4) "echo" [2]=> int(3) } [19]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(3) } [20]=> array(3) { [0]=> int(323) [1]=> string(8) ""hi mom"" [2]=> int(3) } [21]=> string(1) ";" [22]=> array(3) { [0]=> int(382) [1]=> string(9) " " [2]=> int(3) } [23]=> string(1) "}" [24]=> array(3) { [0]=> int(382) [1]=> string(5) " " [2]=> int(4) } [25]=> string(1) "}" }
Output for 5.6.0 - 5.6.28
array(26) { [0]=> array(3) { [0]=> int(376) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(379) [1]=> string(4) " " [2]=> int(1) } [2]=> array(3) { [0]=> int(358) [1]=> string(5) "class" [2]=> int(1) } [3]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(1) } [4]=> array(3) { [0]=> int(310) [1]=> string(4) "test" [2]=> int(1) } [5]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(1) } [6]=> string(1) "{" [7]=> array(3) { [0]=> int(379) [1]=> string(9) " " [2]=> int(1) } [8]=> array(3) { [0]=> int(347) [1]=> string(6) "public" [2]=> int(2) } [9]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(2) } [10]=> array(3) { [0]=> int(337) [1]=> string(8) "function" [2]=> int(2) } [11]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(2) } [12]=> array(3) { [0]=> int(310) [1]=> string(6) "myfunc" [2]=> int(2) } [13]=> string(1) "(" [14]=> string(1) ")" [15]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(2) } [16]=> string(1) "{" [17]=> array(3) { [0]=> int(379) [1]=> string(13) " " [2]=> int(2) } [18]=> array(3) { [0]=> int(319) [1]=> string(4) "echo" [2]=> int(3) } [19]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(3) } [20]=> array(3) { [0]=> int(318) [1]=> string(8) ""hi mom"" [2]=> int(3) } [21]=> string(1) ";" [22]=> array(3) { [0]=> int(379) [1]=> string(9) " " [2]=> int(3) } [23]=> string(1) "}" [24]=> array(3) { [0]=> int(379) [1]=> string(5) " " [2]=> int(4) } [25]=> string(1) "}" }
Output for 5.5.0 - 5.5.35
array(26) { [0]=> array(3) { [0]=> int(374) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(377) [1]=> string(4) " " [2]=> int(1) } [2]=> array(3) { [0]=> int(356) [1]=> string(5) "class" [2]=> int(1) } [3]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(1) } [4]=> array(3) { [0]=> int(308) [1]=> string(4) "test" [2]=> int(1) } [5]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(1) } [6]=> string(1) "{" [7]=> array(3) { [0]=> int(377) [1]=> string(9) " " [2]=> int(1) } [8]=> array(3) { [0]=> int(345) [1]=> string(6) "public" [2]=> int(2) } [9]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(2) } [10]=> array(3) { [0]=> int(335) [1]=> string(8) "function" [2]=> int(2) } [11]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(2) } [12]=> array(3) { [0]=> int(308) [1]=> string(6) "myfunc" [2]=> int(2) } [13]=> string(1) "(" [14]=> string(1) ")" [15]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(2) } [16]=> string(1) "{" [17]=> array(3) { [0]=> int(377) [1]=> string(13) " " [2]=> int(2) } [18]=> array(3) { [0]=> int(317) [1]=> string(4) "echo" [2]=> int(3) } [19]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(3) } [20]=> array(3) { [0]=> int(316) [1]=> string(8) ""hi mom"" [2]=> int(3) } [21]=> string(1) ";" [22]=> array(3) { [0]=> int(377) [1]=> string(9) " " [2]=> int(3) } [23]=> string(1) "}" [24]=> array(3) { [0]=> int(377) [1]=> string(5) " " [2]=> int(4) } [25]=> string(1) "}" }
Output for 5.4.0 - 5.4.45
array(26) { [0]=> array(3) { [0]=> int(372) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(375) [1]=> string(4) " " [2]=> int(1) } [2]=> array(3) { [0]=> int(354) [1]=> string(5) "class" [2]=> int(1) } [3]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(1) } [4]=> array(3) { [0]=> int(307) [1]=> string(4) "test" [2]=> int(1) } [5]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(1) } [6]=> string(1) "{" [7]=> array(3) { [0]=> int(375) [1]=> string(9) " " [2]=> int(1) } [8]=> array(3) { [0]=> int(343) [1]=> string(6) "public" [2]=> int(2) } [9]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(2) } [10]=> array(3) { [0]=> int(334) [1]=> string(8) "function" [2]=> int(2) } [11]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(2) } [12]=> array(3) { [0]=> int(307) [1]=> string(6) "myfunc" [2]=> int(2) } [13]=> string(1) "(" [14]=> string(1) ")" [15]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(2) } [16]=> string(1) "{" [17]=> array(3) { [0]=> int(375) [1]=> string(13) " " [2]=> int(2) } [18]=> array(3) { [0]=> int(316) [1]=> string(4) "echo" [2]=> int(3) } [19]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(3) } [20]=> array(3) { [0]=> int(315) [1]=> string(8) ""hi mom"" [2]=> int(3) } [21]=> string(1) ";" [22]=> array(3) { [0]=> int(375) [1]=> string(9) " " [2]=> int(3) } [23]=> string(1) "}" [24]=> array(3) { [0]=> int(375) [1]=> string(5) " " [2]=> int(4) } [25]=> string(1) "}" }
Output for 5.3.0 - 5.3.29
array(26) { [0]=> array(3) { [0]=> int(368) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(371) [1]=> string(4) " " [2]=> int(1) } [2]=> array(3) { [0]=> int(353) [1]=> string(5) "class" [2]=> int(1) } [3]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(1) } [4]=> array(3) { [0]=> int(307) [1]=> string(4) "test" [2]=> int(1) } [5]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(1) } [6]=> string(1) "{" [7]=> array(3) { [0]=> int(371) [1]=> string(9) " " [2]=> int(1) } [8]=> array(3) { [0]=> int(342) [1]=> string(6) "public" [2]=> int(2) } [9]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(2) } [10]=> array(3) { [0]=> int(334) [1]=> string(8) "function" [2]=> int(2) } [11]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(2) } [12]=> array(3) { [0]=> int(307) [1]=> string(6) "myfunc" [2]=> int(2) } [13]=> string(1) "(" [14]=> string(1) ")" [15]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(2) } [16]=> string(1) "{" [17]=> array(3) { [0]=> int(371) [1]=> string(13) " " [2]=> int(2) } [18]=> array(3) { [0]=> int(316) [1]=> string(4) "echo" [2]=> int(3) } [19]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(3) } [20]=> array(3) { [0]=> int(315) [1]=> string(8) ""hi mom"" [2]=> int(3) } [21]=> string(1) ";" [22]=> array(3) { [0]=> int(371) [1]=> string(9) " " [2]=> int(3) } [23]=> string(1) "}" [24]=> array(3) { [0]=> int(371) [1]=> string(5) " " [2]=> int(4) } [25]=> string(1) "}" }
Output for 5.2.3 - 5.2.17
Parse error: syntax error, unexpected T_SL in /in/stbl6 on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.2
<br /> <b>Parse error</b>: syntax error, unexpected T_SL in <b>/in/stbl6</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
<br /> <b>Parse error</b>: parse error, unexpected T_SL in <b>/in/stbl6</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error in <b>/in/stbl6</b> on line <b>3</b><br />
Process exited with code 255.