How to Transform a String from Multi-Line to Single-Line in PHP? zendnwar August 18, 2014 PHP Basic 1 Comment It is very simple. Just add below code. echo str_replace(array(“\r”,”\n”),””, $str); Related Posts What’s the difference between htmlentities() and htmlspecialchars() in php? zendnwar July 20, 2012 htmlspecialchars: Convert special characters to HTML entities. htmlentities: Convert all appl .. Explain the difference between $var and $$var? zendnwar July 25, 2012 Explain the difference between $var and $$var? $var is a variable and $$var is a variable of an ..