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

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -