note 100230 added to function.str-word-count
| From: | max_nix at lycos dot com | Date: | Sun, 03 Oct 2010 06:14:15 +0000 |
| Subject: | note 100230 added to function.str-word-count | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172903@lists.php.net to get a copy of this message | ||
<?
// a shorter word truncating function
function truncate_words($inputWords, $wordLimit = 25) {
return implode(' ', array_slice(explode(' ', $inputWords), 0, $wordLimit)) .
(count(explode(' ', $inputWords)) <= $wordLimit ? '' : '...');
}
----
Server IP: 69.147.83.197
Probable Submitter: 98.127.111.192
----
Manual Page -- http://www.php.net/manual/en/function.str-word-count.php
Edit -- https://master.php.net/note/edit/100230
Del: integrated -- https://master.php.net/note/delete/100230/integrated
Del: useless -- https://master.php.net/note/delete/100230/useless
Del: bad code -- https://master.php.net/note/delete/100230/bad+code
Del: spam -- https://master.php.net/note/delete/100230/spam
Del: non-english -- https://master.php.net/note/delete/100230/non-english
Del: in docs -- https://master.php.net/note/delete/100230/in+docs
Del: other reasons-- https://master.php.net/note/delete/100230
Reject -- https://master.php.net/note/reject/100230
Search -- https://master.php.net/manage/user-notes.php