3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "Red Cell is very good. Condition is new. But nobody buys it."; $words = ["Red Cell", "Condition", "no", "Red", "new"]; $translations = ["Red Cell", "Stav", "ne", "Červený", "nový"]; $pairs = array_combine($words, $translations); krsort($pairs); $pattern = '~\b(?:' . implode('|', array_keys($pairs)) . ')\b~u'; $result = preg_replace_callback($pattern, function ($m) use ($pairs) { return $pairs[$m[0]]; }, $string); echo $result;
Output for git.master, git.master_jit, rfc.property-hooks
Red Cell is very good. Stav is nový. But nobody buys it.

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