开发者

php string replace without empty space

开发者 https://www.devze.com 2023-04-11 01:45 出处:网络
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开发者_运维问答

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

0

精彩评论

暂无评论...
验证码 换一张
取 消