php str_replace line break code example Example: string remove line breaks php preg_replace( "/\r|\n/", "", $yourString );