I would like to convert this:
a bunch of html
for your viewing pleasure
to this:
a bunch of html for your viewing pleasure
ereg_replace("\n", "", $string) doens't work
neither does str_replace("\n", "", $string);
Removing the n\
Started by PartDigital, May 07 2007 09:06 PM
2 replies to this topic
#1
Posted 07 May 2007 - 09:06 PM
#2
Posted 07 May 2007 - 09:42 PM
PartDigital, on May 7 2007, 10:06 PM, said:
I would like to convert this:
a bunch of html
for your viewing pleasure
to this:
a bunch of html for your viewing pleasure
ereg_replace("\n", "", $string) doens't work
neither does str_replace("\n", "", $string);
a bunch of html
for your viewing pleasure
to this:
a bunch of html for your viewing pleasure
ereg_replace("\n", "", $string) doens't work
neither does str_replace("\n", "", $string);
Try this:
<?
$string = ereg_replace('\\\n','',$string);
?>
Use single quotes and escape the '\' and 'n'. Did that work for you?
#3
Posted 08 May 2007 - 12:58 AM
Are you sure it's not working? If you are on windows, you also have to remove \r.
preg_replace('#(\r\n|\r|\n)#s', '', $text);
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
