note 50135 deleted from function.wordwrap by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 18:36:14 +0000 |
| Subject: | note 50135 deleted from function.wordwrap by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155144@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster at gzevolution dot net
----
Here's one I've being using, feel free to give it a go...
function WrapText($String = "", $BreakAt = 70, $BreakWith = "<br />\n"){
return preg_replace("#([^\s\"'/\.\\-\?&\n\%<>]{". $BreakAt
."})#i"," {$BreakWith}",$String);
}
Function Parameters In Order:
1st - String
2nd - Break Text After X Characters (Default 70)
3rd - Break Insertion (Default <br />\n)