Hello,
I have this string:
$question = In #Year capital#, what is the capital of #Country#?
then I have this array:
$replace[0] = "2011";
$replace[1] = "UK";
Now I want to replace the #Year capital# on $question with $replace[0] and #Country# with $replace[$1]
Now some times it can be more than two items to replace (so the $replace array will have more keys)
I tried something like this:
$q = preg_replace("/#(.*)#/Usi", $replace[0],$question);
$q = preg_replace("/#(.*)#/Usi", $replace[1],$question);
but it doesn't work.
Is there a way to do so?
Many thanks!