I have a lot of MySQL string content that has many instances of "\n" in it. I know that if I'm dealing with strings directly, the "\n" is only interpreted as a line break if I have double quotes around it. However, when the strings come out of the database, they're interpreted literally (the '\n' stays as is). Obviously I can do my own str_replace(), but is there a simple way to treat values from mySQL as if they were double-quote-enclosed strings?
Asked
Active
Viewed 42 times
0
-
http://stackoverflow.com/questions/5241748/php-convert-single-quoted-string-to-double-quoted – Trey Sep 29 '14 at 05:40
-
1reads like the data is going in to the db incorrectly. – Sep 29 '14 at 05:50
-
1`stripcslashes()` does that (and a bit more). But you may still want to fix your prior database population woes. – mario Sep 29 '14 at 05:54
-
The data is Markdown text being imported from CSV files where editors have used \n instead of line breaks as the line breaks are misinterpreted as some unknown character. – jaydisc Sep 29 '14 at 06:00