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