3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<?php class MyClass { function MyFunction3() { // Some code goes here. } function MyFunction4() { // Some code goes here. } public function register(); } '; $tokens = token_get_all($string); foreach ($tokens as $i => $token) { echo "$i : "; if (is_array($token) === false) { echo $token; } else { echo token_name($token[0]).' => '.str_replace(PHP_EOL, '\n', $token[1]); } echo PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
0 : T_OPEN_TAG => <?php\n 1 : T_CLASS => class 2 : T_WHITESPACE => 3 : T_STRING => MyClass 4 : T_WHITESPACE => \n 5 : { 6 : T_WHITESPACE => \n 7 : T_FUNCTION => function 8 : T_WHITESPACE => 9 : T_STRING => MyFunction3 10 : ( 11 : ) 12 : T_WHITESPACE => 13 : { 14 : T_WHITESPACE => \n 15 : T_COMMENT => // Some code goes here. 16 : T_WHITESPACE => \n\n 17 : } 18 : T_WHITESPACE => \n\n 19 : T_FUNCTION => function 20 : T_WHITESPACE => 21 : T_STRING => MyFunction4 22 : ( 23 : ) 24 : T_WHITESPACE => 25 : { 26 : T_WHITESPACE => \n 27 : T_COMMENT => // Some code goes here. 28 : T_WHITESPACE => \n 29 : } 30 : T_WHITESPACE => \n\n 31 : T_PUBLIC => public 32 : T_WHITESPACE => 33 : T_FUNCTION => function 34 : T_WHITESPACE => 35 : T_STRING => register 36 : ( 37 : ) 38 : ; 39 : T_WHITESPACE => \n 40 : } 41 : T_WHITESPACE => \n

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
33.88 ms | 403 KiB | 8 Q