note 48101 deleted from function.str-replace by philip

From: Date: Wed, 07 Oct 2009 08:05:23 +0000
Subject: note 48101 deleted from function.str-replace by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161463@lists.php.net to get a copy of this message
Note Submitter: hermes at andycostell dot com ---- A simple function to take out the double line breaks "%0D%0A" from a string made from text being wrapped in a textarea and turn them into single line breaks. <?php function remove_extra_linebreaks($string) { $new_string=urlencode ($string); $new_string=ereg_replace("%0D", " ", $new_string); $new_string=urldecode ($new_string); return $new_string; } ?> I use it when taking text from a textarea with wrap="hard" that I'm emailing out on the next page, for instance. Otherwise there's an extra empty line between each line in the emailed text, which looks nasty!

« previous php.notes (#161463) next »