3v4l.org

run code in 300+ PHP versions simultaneously
<?php $contents = <<<'PHP' <?php class AClass { public function aMethod() { \$test = true;# a comment } } PHP; $output = ''; foreach (token_get_all($contents) as $token) { if (is_string($token)) { $output .= $token; } elseif (in_array($token[0], [T_COMMENT, T_DOC_COMMENT], true)) { var_dump($token[1]); } elseif (T_WHITESPACE === $token[0]) { var_dump($token[1]); } else { $output .= $token[1]; } }
Output for git.master, git.master_jit, rfc.property-hooks
string(1) " " string(1) " " string(1) " " string(5) " " string(1) " " string(1) " " string(5) " " string(9) " " string(1) " " string(1) " " string(11) "# a comment" string(5) " " string(1) " "

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:
44.47 ms | 406 KiB | 5 Q