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
Post a Comment