php string replace without empty space
I'm using str_replace
to remove some tags within a string, it's being replaced with just ''
but the line is still there, an empty line. I tried to remove \r\n
and variations of, and开发者_运维问答 nothing will remove the empty line, without messing up other formatting.
Is there a way to replace an item in a string without leaving an empty line?
Thanks!
Wrap str_replace
with trim
.
Perform second replacement that removes empty lines
精彩评论