Re: How to detect a line break in a multiline textfield



Thanks for the reply Hendri. I got it sorted out using a simple find
and replace I found by searching for nl2br thanks to your second
post.

Converting textarea line breaks to <br> in PHP
$result = str_replace(array("\r\n", "\r", "\n"), "<br />",
$thestring);

Converting <br> to textarea line breaks in PHP:
$result= str_replace(array("<br/>", "<br>", "<br />"), "\n",
$thestring);

Hope this helps someone,
Ciarán

.



Relevant Pages

  • Web based IDE?
    ... I have been doing quite some php using UltraEdit and Eclipse. ... searching capabilities of a good IDE: ...
    (comp.lang.php)
  • RE: [PHP] datediff in php
    ... Does anyone know if there is a date difference function in php? ... Much like DATEDIFF in ms sql. ... Going to http://www.php.net/date and searching the page for datediff ... seconds cause of all the loops. ...
    (php.general)
  • Re: Stop PHP from rounding
    ... even after searching through all my books, articles, manuals, and ... search engines on PHP, I can't figure out how to stop PHP from ... I am trying to create a calculator that calculates a ... PHP ain't a language made for high precision calculations, if you need a bigger precision, use an external tool written in C++ or any other good language which returns you the value, you can then call the program with execand then use the returned string. ...
    (alt.php)
  • Re: [PHP] Screenshot from web page
    ... Actually I understood that I was searching not real thing. ... I needed PHP code that will generate jpeg from HTML. ... This will put the screenshot on to the ...
    (php.general)
  • Re: Mixing SSI and PHP
    ... I've tried various Apache configuration options and have not been able ... It's too bad there isn't a way to tell PHP to try and parse SSI. ... A bit more searching seemed to tell me the same thing. ...
    (Debian-User)