<?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);
You have javascript disabled. You will not be able to edit any code.