Page 1 of 1
Non-Regex function to replace <br> with <br />?
Posted: Sun Aug 17, 2008 6:03 am
by JAB Creations
I'm currently looking for a non-regex function in PHP that will replace unclosed
<br> elements with properly closed
<br /> elements. I'd
prefer to do this without using regex if at all possible.

Re: Non-Regex function to replace <br> with <br />?
Posted: Sun Aug 17, 2008 6:16 am
by onion2k
What's wrong with str_replace()?
Re: Non-Regex function to replace <br> with <br />?
Posted: Sun Aug 17, 2008 6:25 am
by JAB Creations
I was applying this to the wrong part of my script which is the only reason you beat me to post #2.
Code: Select all
$message_xml = str_replace("<br>", "<br />", $message);