note 28696 deleted from function.wordwrap by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 18:37:46 +0000 |
| Subject: | note 28696 deleted from function.wordwrap by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155151@lists.php.net to get a copy of this message | ||
Note Submitter: subzane at home dot se
----
I use preg_replace instead...
This function doesn't cut in HTML tags, just in the plain text.
<?php
function WrapWords($str, $chars) {
$str = preg_replace('/([^\s\<\>]{'.$chars.','.$chars.'})/',
'\1 ', $str);
return $str;
}
?>