Re: feature request
| From: | Daniel Lorch | Date: | Wed, 24 Apr 2002 20:15:19 +0000 |
| Subject: | Re: feature request | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-83277@lists.php.net to get a copy of this message | ||
Hi,
> It would be great if there was a function in the filesystem family similar
> to the unix command "wc". It'd be nice to not have to write simple wrappers
> around system calls or creating arrays to get the number of words or lines
> in a file.
function line_count($string) {
return count(preg_split("/\r?\n/", $string));
}
function word_count($string) {
return count(preg_split("/\s+/", $string));
}
There will be a PEAR-string class, which includes functions similar to
this. I assigned it to me some days ago and I will be working on it as
soon as I have some time left :)
-daniel