3v4l.org

run code in 300+ PHP versions simultaneously
<?php function replace($string) { return preg_replace_callback('/(?<tag>(?<enter><)?!(?<level>\d+)!(?<leave>>)?)/', function ($match) { $level = (int) $match['level']; $enter = !empty($match['enter']); $leave = !empty($match['leave']); if ($enter === $leave) { var_dump($match); return $match['tag']; } if ($level > 0) { return vsprintf('%s!%d!%s', [ $enter ? '<' : null, $level - 1, $leave ? '>' : null, ]); } return vsprintf('%s?%s', [ $enter ? '<' : null, $leave ? '>' : null, ]); }, $string); } $string = '<!3!= "<!2!= "<!1!= "<!0!= "noodles" !0!>" !1!>" !2!>" !3!>'; ob_start(); eval(sprintf('; ?>%s<?php ', replace($string))); $string = ob_get_clean(); echo $string . PHP_EOL; ob_start(); eval(sprintf('; ?>%s<?php ', replace($string))); $string = ob_get_clean(); echo $string . PHP_EOL; ob_start(); eval(sprintf('; ?>%s<?php ', replace($string))); $string = ob_get_clean(); echo $string . PHP_EOL; ob_start(); eval(sprintf('; ?>%s<?php ', replace($string))); $string = ob_get_clean(); echo $string . PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
<!2!= "<!1!= "<!0!= "noodles" !0!>" !1!>" !2!> <!1!= "<!0!= "noodles" !0!>" !1!> <!0!= "noodles" !0!> noodles

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:
56.53 ms | 401 KiB | 8 Q