Jump to content

[SOLVED] Remove HTML whitespace


Michan

Recommended Posts

Hi,

 

I seem to be stuck. I've tried replacing \n and \r, but it doesn't seem to have any effect on the code, which looks something like this:

 

Line 1<br />

Line 2<br />

Line 3

 

How would I fix this with a function so it would display in HTML as the following?

 

Line 1<br />Line 2<br />Line 3

 

Many thanks in advance,

 

- Mi

Link to comment
Share on other sites

Just use PHP_EOL, as it uses the appropriate End of Line depending on the OS. Also F1Fan, str_replace() takes 3 parameters. :)

 

Thank you very much for this. It tidies it all onto a single line, but converts all of the <, >, ", ', &, etc into their HTML codes. Is there a way to remove the HTML returns without converting all of the HTML codes?

 

Many thanks again!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.