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
Edited
I did this and worked perfect
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:
$description = preg_replace('~[\r\n\s\t]+~', ' ', $description);
Edited
I did this and worked perfect
PHP:
$to_replace = array("\r\n","|","\n","\\r\\n","\\n","&");
$description = str_replace($to_replace, "\n", $description);
$description = preg_replace('~[\n]+~', '<br>', $description);
Last edited:







