I've got a preg_replace that tosses <li></li>'s around every new line. I know it works on windows machines, but I know the code doesn't account for any other systems. $body = preg_replace("/\n/","</li><li>",$body); What should I change here? Thanks!
Unless you need variable embedding you should always use single quotes for strings, it saves on parsing time and you dont have to use complicated escape sequences like \\r\\n.
That definitely won't do what you're hoping... The <li> tags are backwards. In any case, the original code was replacing every newline with a closing tag and then an opening tag, I'm assuming <ul><li> is output before the regex and </li></ul> after it.