3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = '<?php print "$array[\'a\']";'; foreach (token_get_all($str) as $t) { if (is_array($t)) { $n = token_name($t[0]); $v = $t[1]; } else { $n = "(literal)"; $v = $t; } printf("%25s: %s\n", $n, var_export($v,TRUE)); }

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
T_OPEN_TAG: '<?php ' T_PRINT: 'print' T_WHITESPACE: ' ' (literal): '"' T_VARIABLE: '$array' (literal): '[' T_ENCAPSED_AND_WHITESPACE: '' T_ENCAPSED_AND_WHITESPACE: '\'a\']' (literal): '"' (literal): ';'
Output for Arrow functions
T_OPEN_TAG: '<?php ' T_PRINT: 'print' T_WHITESPACE: ' ' (literal): '"' T_VARIABLE: '$array' (literal): '[' T_ENCAPSED_AND_WHITESPACE: '' T_ENCAPSED_AND_WHITESPACE: '\'a\']' (literal): '"' (literal): ';'
Output for Object typehint
T_OPEN_TAG: '<?php ' T_PRINT: 'print' T_WHITESPACE: ' ' (literal): '"' T_VARIABLE: '$array' (literal): '[' T_ENCAPSED_AND_WHITESPACE: '' T_ENCAPSED_AND_WHITESPACE: '\'a\']' (literal): '"' (literal): ';'
Output for Array change keys
T_OPEN_TAG: '<?php ' T_PRINT: 'print' T_WHITESPACE: ' ' (literal): '"' T_VARIABLE: '$array' (literal): '[' T_ENCAPSED_AND_WHITESPACE: '' T_ENCAPSED_AND_WHITESPACE: '\'a\']' (literal): '"' (literal): ';'
Output for Lexical anon
T_OPEN_TAG: '<?php ' T_PRINT: 'print' T_WHITESPACE: ' ' (literal): '"' T_VARIABLE: '$array' (literal): '[' T_ENCAPSED_AND_WHITESPACE: '' T_ENCAPSED_AND_WHITESPACE: '\'a\']' (literal): '"' (literal): ';'

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