 |
Results from the most recent live auction are here.
18 members in the live chat room. Join Chat!
| |
04-15-2008, 12:34 PM
|
· #1 | | NamePros Member | Turning multiple line breaks into one Hello,
How can i change two or more than 2 line breaks into one?
I am using this for spaces and it works perfect but i do not know how to do for line breaks PHP Code: $description = preg_replace('~[\r\n\s\t]+~', ' ', $description);
Edited
I did this and worked perfect PHP Code: $to_replace = array("\r\n","|","\n","\\r\\n","\\n","&");
$description = str_replace($to_replace, "\n", $description);
$description = preg_replace('~[\n]+~', '<br>', $description);
Last edited by baris22 : 04-15-2008 at 12:52 PM.
|
| |
04-16-2008, 05:06 AM
|
· #2 | | The original NP Emo Kid Name: Liam Dawe Location: Plymouth, UK Join Date: Jan 2005
Posts: 1,577
NP$: 124.00 ( Donate)
|
You realise in that array you have "&" right? so your "&"'s will be replaced too... |
| |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |