Jump to content

Detecting two newlines


Jeremysr

Recommended Posts

I'm making a program where someone enters text into a textbox and then in the next page I need to change all the double newlines ("\n\n") into two linebreak tags. For some reason this works:

[code]str_replace("\n", "<br />", $input);[/code]

But this doesn't work:

[code]str_replace("\n\n", "<br /><br />", $input);[/code]

I want the single newlines to be ignored though. Can someone tell me what the problem is?
Link to comment
https://forums.phpfreaks.com/topic/31709-detecting-two-newlines/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.