note 8359 deleted from str_replace by jmcastagnetto

From: Date: Fri, 08 Sep 2000 02:06:54 +0000
Subject: note 8359 deleted from str_replace by jmcastagnetto
Groups: php.notes 
Request: Send a blank email to php-notes+get-4470@lists.php.net to get a copy of this message
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("rn", "", $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("/rn|nr|n|r/", "", $string);

« previous php.notes (#4470) next »