note 110797 deleted from function.strip-tags by aharvey
| From: | aharvey@php.net | Date: | Mon, 10 Dec 2012 00:52:29 +0000 |
| Subject: | note 110797 deleted from function.strip-tags by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192435@lists.php.net to get a copy of this message | ||
Note Submitter: sirmagid at gmail dot com
----
function substrword($text, $length = 100, $replacer = '...', $isStrips = true, $stringtags
= '') {
$string = $isStrips ? strip_tags($text, $stringtags) : $text;
$tmp = explode(" ", $string);
if (count($tmp) < $length)
return $string;
$string = implode(" ", array_slice($tmp, 0, $length)) . $replacer;
return $string;
}