#native_company# #native_desc#
#native_cta#

How to make linebreaks n s…

By Chris Heilmann
on February 9, 2001

I had the following thing to achieve:
for a Homesite extension, I needed the data of a textarea to be put in a textfield and all real linebreaks to become n …

Sound easy but was quite a pain, as I tried to make a nl2br and change the br’s back to n, no can do, as PHP surrounds them by linebreaks.

Now the solution is ridiculously easy:

$message=eregi_replace("
","n",$message);

I am sure there is some nifty regular expression as well, but that’s how I got lucky.

No rocket science, but hey…

/Chris