Php convert single quote to double quote for line break character

I have a line coming from a language file containing lines of text in the current language.

$str = 'blabla\n\nmore blabla';

      

$ str will be used in the textbox where \ n should be the border If I put it in double quotes it works.

The problem is that $ str will always be in single quotes. I have been googling and looking for this site. There are many similar questions, but I was unable to find a solution.

How do I convert my single quoted string (with the literal "\ n") to a double quoted string (where "\ n" is converted to a string)?

+3


source to share


1 answer


$ str = str_replace ('\ n', "\ n", $ str);



+8


source







All Articles