I have a text input which can contain special chars that needs to be escaped. But I also want to preserve the newlines. Using PHP's mysql\_real\_escape\_string(), how is it possible to ignore the newline ('\n') from escaping. 

From the official [docs](https://www.php.net/manual/en/mysqli.real-escape-string.php) of PHP on `mysqli_real_escape_string`:

```
mysqli_real_escape_string ( mysqli $link , string $escapestr ) : string

```

> 
> escapestr: The string to be escaped.
> 
> 
> Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z.
> 
> 
> 

How is it possible to omit the `\n` from this list but keeping the others intact?