note 50394 added to function.trim

From: Date: Sat, 26 Feb 2005 22:33:08 +0000
Subject: note 50394 added to function.trim
Groups: php.notes 
Request: Send a blank email to php-notes+get-85615@lists.php.net to get a copy of this message
This might come in handy when you want to convert multiple newlines to one (e.g. to preserve your guestbook's layout). <?php $str = ereg_replace ("[\r\n]+", "\r\n", $str); ?> Or, as a function: <?php function single_nl($str) { return ereg_replace ("[\r\n]+", "\r\n", $str); } ?> Only tested on Windows though. ---- Manual Page -- http://www.php.net/manual/en/function.trim.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50394 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50394&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50394&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50394&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50394&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50394&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50394&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85615) next »