3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'hello w1 w2 w12 new1 new12 new2'; $map = [ 'w1' => 'new1', 'w2' => 'new2', 'new1' => 'w1', 'new2' => 'w2', ]; $subpattern = implode('|', array_map('preg_quote', array_keys($map))); echo preg_replace_callback( '#\b(?:' . $subpattern . ')\b#u', fn($m) => $map[$m[0]] ?? $m[0], $string );
Output for git.master, git.master_jit, rfc.property-hooks
hello new1 new2 w12 w1 new12 w2

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