0

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!

0

2 Answers 2

2

Wrap str_replace with trim.

Sign up to request clarification or add additional context in comments.

Comments

1

Perform second replacement that removes empty lines

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.