3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "Line <br> Line <br> Line <br> Line <br> Line <br> Line <br>"; $replace = array("1", "2", "3", "4"); $counter = 0; $text = preg_replace_callback('~<br\s*/?>~', function($m) use($replace, &$counter) { if ($counter === count($replace)) { $counter = 0; } return $replace[$counter++]; }, $text); echo $text;
Output for git.master, git.master_jit, rfc.property-hooks
Line 1 Line 2 Line 3 Line 4 Line 1 Line 2

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:
117.18 ms | 405 KiB | 5 Q