note 75728 deleted from function.str-word-count by danbrown
| From: | danbrown@php.net | Date: | Fri, 31 Aug 2012 16:26:10 +0000 |
| Subject: | note 75728 deleted from function.str-word-count by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190367@lists.php.net to get a copy of this message | ||
Note Submitter: geertdd at gmail dot com
----
This is an update to my previously posted word_limiter() function. The regex is even more optimized
now. Just replace the preg_match line. Change to:
<?php
preg_match('/^\s*(?:\S+\s*){1,'. (int) $limit .'}/', $str, $matches);