Re: Quick hellp, How do I stip new lines?

From: Date: Sat, 17 Feb 2001 02:48:06 +0000
Subject: Re: Quick hellp, How do I stip new lines?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-40281@lists.php.net to get a copy of this message
Trim() will in fact only strip whitespace from the beginning or end of the string; if he has \n's anywhere in the middle of the string, trim will do perform the desired operation. Ereg_replace() is unnecessary for a simple search/replace operation; str_replace() will suffice and is faster to some degree. Try: $str = str_replace("\n", '', $str); --Toby Brian Clark wrote: > > Hi Kath, > > @ 9:41:34 PM on 2/16/2001, kath@kathweb.net wrote: > > > You want to totally remove \n? > > > $something = ereg_replace("\n"," ",$something); > > trim() will suffice. > > http://www.php.net/manual/en/function.trim.php > > -Brian > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#40281) next »