php - how do i use string replace to remove a carrage return from a string -
hi how use string replace remove carrage return string
here string:
{ $content = '<p>some random text <a href= "http://url.co.uk/link/">link text</a> more random text.</p>'}
and here sring replace command
{$content=str_replace('carrage return', '', $content);}
the think cant seem find replace 'carrage return' with. reason doing reg expression on string fails if there carrage return in serached string doesnt match reg expression.
also on asside note if 1 posts response question how query them on posting.
second asside how hell html show on here ive tried '' "" () {} :(
be gentil im newby , got punched in face on here :( second post , dropped load of score :(
there 2 chars used line endings, \n
(ascii: 10, unix/linux) , \r
(ascii: 13, mac os). on windows combination of 2 used \r\n
. rid of of them use this:
$str = str_replace(array("\n", "\r", "\r\n"), '', $input);
Comments
Post a Comment