On 26 November 2003 16:59, [EMAIL PROTECTED] contributed these pearls of wisdom:
> Why doesn't this work...? > > $body = " > <p>blurb blah > <p>happy days > <p>end of text"; > > $body = trim($body); > > $body now should output: > "<p>blurb blah\n<p>happy days\n<p>end of text" but it > doesn't...? No it shouldn't -- it should output exactly what you've put into the string, minus any trailing spaces (of which there aren't any). trim() has nothing to do with escapifying newline characters. If you wnat your text output to javascript with \n in them, then that's exactly what you should put in them -- either that, or run a str_replace() to turn the newlines into \n sequences. So: $body = "<p>blurb blah\\n<p>happy days\\n<p>end of text"; echo $body or $body = " <p>blurb blah <p>happy days <p>end of text"; echo str_replace("\n", '\n', $body); Cheers! Mike -- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php