3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $phrase = "The key is now set to :key"; $key = ":key"; $var = "if > $1000"; $re = "/(.+?)(" . $key . ")(.*)/"; $subst = "\1'" . $var . "'\3"; echo preg_replace($re, $subst, $phrase);
based on oUDpQ
Output for 5.3.18 - 7.2.0
'if > 00'