remove newline 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);
Example 3: string remove line breaks php
preg_replace( "/\r|\n/", "", $yourString );