In PHP, I am processing strings between double-quotes, where I have no control over how those strings are generated. Somehow, at some point, newlines appear at the end of some of the strings. It results into something like this:
"This is a value"
"I'm another string!"
"I somehow have a newline at the end
"
"Okay, this is the last one.."
How can I best remove these newlines if I were to iteratively loop through all of these strings?
I can imagine I should use preg_replace, but I don't know what is the best pattern to get rid of the newlines at the end of a quoted string.
Thanks in advance!
Jeroen