note 55749 added to function.str-word-count

From: Date: Fri, 12 Aug 2005 07:56:04 +0000
Subject: note 55749 added to function.str-word-count
Groups: php.notes 
Request: Send a blank email to php-notes+get-93484@lists.php.net to get a copy of this message
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]." "; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.str-word-count.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55749 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55749&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55749&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55749&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55749&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55749&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55749&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55749&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93484) next »