> 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 :)

Again, my issue is NOT that I don't know how to write word_count or
line_count functions, but that PHP doesn't offer this as a built in
function, and in my opinion it should.  Someone using PHP as a language
shouldn't have to write their own wrapper functions using regular
expressions or download PHPLIB, PEAR, or any other additional libraries to
do something so simple.

Especially when you have such fancy buit-ins like "parse_ini"file" and
"pathinfo", and other built in unix commands like "touch", "chown", and
"chmod".

Nik



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

Reply via email to