jeddi
09-13-2009, 06:03 PM
Hi,
I am having trouble of a simple replacement of line feeds
in a variable that goes into an email.
I want to wordwrap to 70 characters and replace the line feeds with <br> so that it looks good in the email.
This is my 2 lines of code:
( Now I am sure that I used this before somewhere and it worked )
$reply = wordwrap($Db_rep,70);
$reply = nl2br($reply);
This produced this result:
Dear Dave,\r\n\r\nThanks for your support request message.
\r\n\r\nhope you got that cat that I sent\r\nyou in the
post.\r\n\r\nwas it still purring?
It is wordwrapped but the rn's are still there.
Then I tried:
$reply = wordwrap($Db_rep,70);
$reply = str_replace("\r\n\\","<br>",$reply);
Result:
Dear Dave,\r\n\r\nThanks for your support request message. \r\n\r\nhope you got that cat that I sent\r\nyou in the post.\r\n\r\nwas it still purring?
No line feed change and no wordwrap :(
Well I must be something wrong, but
I just can not see what it is :o
I am having trouble of a simple replacement of line feeds
in a variable that goes into an email.
I want to wordwrap to 70 characters and replace the line feeds with <br> so that it looks good in the email.
This is my 2 lines of code:
( Now I am sure that I used this before somewhere and it worked )
$reply = wordwrap($Db_rep,70);
$reply = nl2br($reply);
This produced this result:
Dear Dave,\r\n\r\nThanks for your support request message.
\r\n\r\nhope you got that cat that I sent\r\nyou in the
post.\r\n\r\nwas it still purring?
It is wordwrapped but the rn's are still there.
Then I tried:
$reply = wordwrap($Db_rep,70);
$reply = str_replace("\r\n\\","<br>",$reply);
Result:
Dear Dave,\r\n\r\nThanks for your support request message. \r\n\r\nhope you got that cat that I sent\r\nyou in the post.\r\n\r\nwas it still purring?
No line feed change and no wordwrap :(
Well I must be something wrong, but
I just can not see what it is :o