3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = '<?php public function enum($value, ...$items) {}'; $tokens = token_get_all($string); foreach ($tokens as $token) { if (is_array($token) === true) { $name = token_name($token[0]); echo "TOKEN $name FOUND: ".$token[1]."\n"; } }
based on UTJR3
Output for 5.6.7 - 7.1.0
TOKEN T_OPEN_TAG FOUND: <?php TOKEN T_PUBLIC FOUND: public TOKEN T_WHITESPACE FOUND: TOKEN T_FUNCTION FOUND: function TOKEN T_WHITESPACE FOUND: TOKEN T_STRING FOUND: enum TOKEN T_VARIABLE FOUND: $value TOKEN T_WHITESPACE FOUND: TOKEN T_ELLIPSIS FOUND: ... TOKEN T_VARIABLE FOUND: $items TOKEN T_WHITESPACE FOUND:
Output for 5.0.0 - 5.5.35
TOKEN T_OPEN_TAG FOUND: <?php TOKEN T_PUBLIC FOUND: public TOKEN T_WHITESPACE FOUND: TOKEN T_FUNCTION FOUND: function TOKEN T_WHITESPACE FOUND: TOKEN T_STRING FOUND: enum TOKEN T_VARIABLE FOUND: $value TOKEN T_WHITESPACE FOUND: TOKEN T_VARIABLE FOUND: $items TOKEN T_WHITESPACE FOUND:
Output for 4.3.0 - 4.4.9
TOKEN T_OPEN_TAG FOUND: <?php TOKEN T_STRING FOUND: public TOKEN T_WHITESPACE FOUND: TOKEN T_FUNCTION FOUND: function TOKEN T_WHITESPACE FOUND: TOKEN T_STRING FOUND: enum TOKEN T_VARIABLE FOUND: $value TOKEN T_WHITESPACE FOUND: TOKEN T_VARIABLE FOUND: $items TOKEN T_WHITESPACE FOUND: