remove new line in string php code example
Example 1: remove line break html php
preg_replace( "/\r|\n/", "", $yourString );
Example 2: php remove newline
//Replace the newline and carriage return characters
//using regex and preg_replace.
$text = preg_replace("/\r|\n/", "", $text);