remove extra n from string php code example Example: how remove \r\n from string in php $text = preg_replace("/\r|\n/", "", $text);