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