What is the recommended method to convert line breaks back from \r\n to \n after using mysql_real_escape?

When using mysql_real_escape_string to escape special characters in a string, line breaks are converted from \n to \r\n. To convert them back, you can use the PHP function str_replace to replace \r\n with \n.

$escaped_string = mysql_real_escape_string($original_string);
$unescaped_string = str_replace("\r\n", "\n", $escaped_string);