Jump to content

Archived

This topic is now archived and is closed to further replies.

craigbabe

Counting the amount of words in a string?

Recommended Posts

All I can find is how many characters there is but I want words. Do you know how i can do this?
Happy Easter btw

Share this post


Link to post
Share on other sites
PHP 4.3.0+ example:

[code]
$msg = "Hello world!";

echo str_word_count($msg); // displays 2
[/code]
[a href=\"http://us2.php.net/manual/en/function.str-word-count.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.str-word-count.php[/a]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.