php - using nl2br to insert a line break only once rather than before each new line -


I have a string and I am using nl2br to insert line breaks .

How can I make it? Before breaking all the new lines just before breaking a new line, insert all the new lines before a line break instead

< Div class = "post-text" itemprop = "text">

to match all repeating br and a single

  $ pattern = "/ (\ & lt ; Br / / & gt;) as well as can use preg_replace () + / I "; $ Replacement = "

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -