Jump to content


Photo

carriage returns


  • Please log in to reply
1 reply to this topic

#1 laxplayin24

laxplayin24
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 19 May 2006 - 03:28 PM

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.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 19 May 2006 - 03:35 PM

If you want to remove line breaks/carrage returns then use this:

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

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

echo $var;

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users