Quarterbore
07-19-2007, 03:03 PM
I have a problem with a script in that the script saved line breaks between values that were saved. Well, the script was written that way for another purpose but now it is causing me issues...
I know I can take normal text like this and remove the /n's
$myvalues = 'cars/ntrucks/nautomibiles';
Using code like this:
$myvalues = ereg_replace('/n', '', $myvalues);
HOWEVER, I do not know how to remove LINE BREAKS which I assume would be \n in the data?
For example:
<?php
$myvalues = 'cars
trucks
automibiles';
echo $myvalues . '<br />';
$myvalues = ereg_replace('/n', '', $myvalues);
echo $myvalues . '<br />';
?>
Outputs the data like this (HTML CODE):
cars
trucks
automibiles<br />cars
trucks
automibiles<br />
Can someone help be strip these line breaks out of my string?
EDIT to change the title to help someone else that may search this!
I know I can take normal text like this and remove the /n's
$myvalues = 'cars/ntrucks/nautomibiles';
Using code like this:
$myvalues = ereg_replace('/n', '', $myvalues);
HOWEVER, I do not know how to remove LINE BREAKS which I assume would be \n in the data?
For example:
<?php
$myvalues = 'cars
trucks
automibiles';
echo $myvalues . '<br />';
$myvalues = ereg_replace('/n', '', $myvalues);
echo $myvalues . '<br />';
?>
Outputs the data like this (HTML CODE):
cars
trucks
automibiles<br />cars
trucks
automibiles<br />
Can someone help be strip these line breaks out of my string?
EDIT to change the title to help someone else that may search this!