Skip to content
Advertisement

PHP – replace all “n” Occurrences in a string

I am getting a string in my PHP output with lots of n characters which I would like to convert into <p> to get a new line characters in html outpot.

I have tried following:

JavaScript

Both of these doesn’t seems to work. Any ideas what’s wrong in the syntax?

Advertisement

Answer

Try this:

PHP:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement