I have a sentence in the DB for example:
His $name$ is $Luis$
Now, I want to replace the $..$ in tags (< b >), for something like:
His <b>name</b> is <b>Luis</b>
How can I do it with preg_replace? I tried to do simply:
$replace[0] = '<b>';
$replace[1] = '</b>';
preg_replace('/[$]/', $replace, $string);
But doesn’t work.
1 Answer