Navigation :

Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Blog
Books
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links




Site Sponsors :

Bookmark :

Links :

domain names
programmershelp
software directory

Downloads :

Misc :

Webmaster Resources
Only PHP
ScriptSearch.com
Scripts.com - Get the best scripts NOW!
AndreaPHP Programming

Valid XHTML 1.0 Transitional


Valid CSS!




a better example of counting the amount of words in a string

a better example of counting the amount of words in a string

more practical example of counting words in a string.

<?php
$message = "this will have some text filtered out and will not display because it has more than 10 words";
//$message = "this sentence is OK";
$result = str_word_count($message);
if($result > 10)
{
echo "sorry that sentence contains too many words " . $result . " to be exact";
}
else
{
echo $message;
}
?>