Re: note 8359 added to str_replace

From: Date: Fri, 08 Sep 2000 02:11:17 +0000
Subject: Re: note 8359 added to str_replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-4472@lists.php.net to get a copy of this message
Use trim() or chop() instead of these workarounds. Read the manual for more info. Your note has been removed from the online manual. --- lpphess@ihc.com wrote: > You can remove end of line characters using > str_replace. > > $string = str_replace("\n", "", $string); > > However I found that sometimes there is a > combination \r and \n (carriage return and line > feed). You can do a one liner to remove those. > > $string = str_replace("\r\n", "", $string); > > If you are not sure what order they are in (like > me), you can use a regular expression function to > replace all of the possible different permutations > of \r and \n. See preg_replace for more info on > syntax. > > $string = preg_replace("/\r\n|\n\r|\n|\r/", "", > $string); > > > > > http://www.php.net/manual/function.str-replace.php > > > -- > PHP Notes Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > php-notes-unsubscribe@lists.php.net > For additional commands, e-mail: > php-notes-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > ===== --- Jesus M. Castagnetto (jcastagnetto@yahoo.com) __________________________________________________ Do You Yahoo!? Yahoo! Mail - Free email you can access from anywhere! http://mail.yahoo.com/

« previous php.notes (#4472) next »