Jump to content

Archived

This topic is now archived and is closed to further replies.

laxplayin24

carriage returns

Recommended Posts

I have some text that I am getting that has carriage returns in it and i was wondering if there is a way in php to remvoe them from the text. Thanks for the help.

Share this post


Link to post
Share on other sites
If you want to remove line breaks/carrage returns then use this:

[code]$var = "This has carriage \r\nreturns in it \r . . . . \n . . .  ";

$var = str_replace(array("\r", "\n"), "", $var);

echo $var;[/code]

\r\n - for windows
\r - for mac
\n - linux/unix

Share this post


Link to post
Share on other sites

×

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.