Menu
Say you have a string:
[code=php]
$str=’This is a<wbr /> line of te<wbr />xt’;
I want to wrap certain words with a span tag, like:
[code=php]
preg_replace(‘/text/’,'<span>$1</span>’,$str);
But obviously that doesnt work because in the string there is a ‘<wbr />’ in the middle of it. Note that I can’t strip out the ‘<wbr />’.
Does anyone know how I would go about doing this?
Many thanks!