note 27920 added to function.wordwrap
| From: | shaun at phplabs dot com | Date: | Wed, 25 Dec 2002 09:24:38 +0000 |
| Subject: | note 27920 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41274@lists.php.net to get a copy of this message | ||
Here's some code which will turn text into a quoted message, that is, split a chunk of text
into wrapped lines and prefix each line of text with a > sign (or some other delimiter). I found
myself using this snippet so many times while writing an autoresponder that I just dropped it into a
function.
function mailquote($text, $marker){
$text = str_replace("\n", "\n$marker", wordwrap($text, 70));
return $text;
}
e.g.
mailquote($text, "> ");
> Would result in a long passage of text
> being broken into multiple lines, each
> line starting with a traditional "quote"
> marker, like this.
--
http://www.php.net/manual/en/function.wordwrap.php
http://master.php.net/manage/user-notes.php?action=edit+27920
http://master.php.net/manage/user-notes.php?action=delete+27920
http://master.php.net/manage/user-notes.php?action=reject+27920