3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * T_ML_COMMENT n'existe pas en PHP 5. * Les lignes suivantes le définisse afin de rendre * compatible notre code. * * Ensuite, les 2 lignes définissent T_DOC_COMMENT uniquement pour PHP 5, * que nous masquons en T_ML_COMMENT pour PHP 4. */ if (!defined('T_ML_COMMENT')) { define('T_ML_COMMENT', T_COMMENT); } else { define('T_DOC_COMMENT', T_ML_COMMENT); } $source = file_get_contents('example.php'); $tokens = token_get_all($source); foreach ($tokens as $token) { if (is_string($token)) { // un simple caractère token echo $token; } else { // tableau token list($id, $text) = $token; switch ($id) { case T_COMMENT: case T_ML_COMMENT: // nous avons défini ceci case T_DOC_COMMENT: // et ceci // Aucune action sur les commentaires break; default: // rien d'autre -> affiche "as is" echo $text; break; } } } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: file_get_contents(): open_basedir restriction in effect. File(example.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/jXv1T on line 16 Warning: file_get_contents(example.php): Failed to open stream: Operation not permitted in /in/jXv1T on line 16

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:
37.04 ms | 402 KiB | 8 Q