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



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to