MyBB Community Forums
Multiple lines to one line (php) - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Multiple lines to one line (php) (/thread-22807.html)



Multiple lines to one line (php) - Smethead - 2005-08-14

I'm still working on the gallery mod, but outside the mybb system now. I'll see how far I can integrate it in mybb when it's done. But I have a little problem now. I'm working on adding descriptions but if someone adds a description in 2 or more lines, the script doesn't work. So I want to know how to merge them into 1 line.
Like this:
Quote:This is the first line
This is the second one
Third
.....
Must become this:
Quote:This is the first line<br>This is the second one<br>Third<br>.....

EDIT: I found it myself by using this:
	$str = str_replace(chr(13), "<br>", $str);
	$str = str_replace("\n", "", $str);