aot2002
asked on
doesnt this get rid of newlines in a string ?
doesnt this get rid of newlines in a string ?
$string = ereg_replace ("\n", "", $string);
-->this is not working !!!
$tmp= ereg_replace ("\n", "", $results2['DESC'][0]);
$string = ereg_replace ("\n", "", $string);
-->this is not working !!!
$tmp= ereg_replace ("\n", "", $results2['DESC'][0]);
try this:
$string = ereg_replace("\r?\n", "", $string);
$string = ereg_replace("\r?\n", "", $string);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think it should be:
$tmp= ereg_replace ('\n', "", $results2['DESC'][0]); // simple quotes instead of double quotes
Georgiana
$tmp= ereg_replace ('\n', "", $results2['DESC'][0]); // simple quotes instead of double quotes
Georgiana
Maybe also try:
$string = ereg_replace (chr(13), "", $string);
$string = ereg_replace (chr(13), "", $string);
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
wow holy answers !
let me try these and get right back to you
let me try these and get right back to you
ASKER
$parttypedesc = ereg_replace("\r?\n?", "", $results2['PART_TYPE_DESC' ][0]);
This worked GREAT THANKS !
This worked GREAT THANKS !
ASKER
Comment from gicutza_cj feedback
Date: 09/30/2004 03:17AM EDT
Comment
I think it should be:
$tmp= ereg_replace ('\n', "", $results2['DESC'][0]); // simple quotes instead of double quotes
Georgiana
THIS DIDNT WORK i do know from experience that \n wont work in single quotes unless something has changed
Date: 09/30/2004 03:17AM EDT
Comment
I think it should be:
$tmp= ereg_replace ('\n', "", $results2['DESC'][0]); // simple quotes instead of double quotes
Georgiana
THIS DIDNT WORK i do know from experience that \n wont work in single quotes unless something has changed
You know that ereg is executed slower than str_replace is, although minimal it's something to keep in mind.
-r-
-r-
ASKER
thanks i didnt know this i always wondered why php site pointed everything to ereg not str_replace ?
are they removing str_replace ?
are they removing str_replace ?
no. some people just think because ereg looks complicated, it looks impressive when they use it, I suppose.
$replace = array ("\n","\r");
$string = str_replace($replace,'',$s