I need to strip all <br /> and all ‘quotes’ (") and all ‘ands’ (&) and replace them with a space only …
How can I do this? (in PHP)
I have tried this for the <br />:
$description = preg_replace('<br />', '', $description);
But it returned <> in place of every <br />…
Thanks
To manipulate HTML it is generally a good idea to use a DOM aware tool instead of plain text manipulation tools (think for example what will happen if you enounter variants like
<br/>,<br />with more than one space, or even<br>or<BR/>, which altough illegal are sometimes used). See for example here: http://sourceforge.net/projects/simplehtmldom/