RE: newlines to BR tag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Murat BIYIKLI wrote:
>if there are unknown number of newlines 
>repeating like (\r\n\r\n\r\n) in a post 
>var and if I want to change them to a 
>SINGLE newline, what kind of an iteration 
>should be used? The >message may like below 
>in DB and as you see the \r\n newline codes 
>may repeat severaltimes and should be changed
> to only one SINGLE newline and after read 
>from DB it will be easily coverted to BR tag 
>by nl2br($foo) func.

Instead of using nl2br you could just use
$foo=preg_replace("/(\r\n)+/","<br>",$foo).

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux