3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<div class="something">What </div> if it it is is same <div style="color:red;">same </div>'; echo preg_replace_callback('~</?\b[^<>]+>(*SKIP)(*F)|\w+~', function($matches) { static $counter = 0; return "<span class=\"splits split".(++$counter)."\">{$matches[0]}</span>"; }, $string);
Output for git.master, git.master_jit, rfc.property-hooks
<div class="something"><span class="splits split1">What</span> </div> <span class="splits split2">if</span> <span class="splits split3">it</span> <span class="splits split4">it</span> <span class="splits split5">is</span> <span class="splits split6">is</span> <span class="splits split7">same</span> <div style="color:red;"><span class="splits split8">same</span> </div>

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