note 55749 deleted from function.str-word-count by danbrown
| From: | danbrown@php.net | Date: | Fri, 31 Aug 2012 16:28:43 +0000 |
| Subject: | note 55749 deleted from function.str-word-count by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190377@lists.php.net to get a copy of this message | ||
Note Submitter: muz1 at muzcore dot com
----
This function is awesome however I needed to display the first 100 words of a string. I am
submitting this as a possible solution but also to get feedback as to whether it is the most
efficient way of doing it.
<?
$currString = explode(" ", $string);
for ($wordCounter=0; $wordCounter<100; $wordCounter++) { echo $currString[$wordCounter]."
"; }
?>