Home | Scripts | Tutorials | Books | Hosting | Forums | Links|

Navigation:

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






 
 

SPONSORS



 
 

Count words in a sentence

This is another example of how to count the number of words in a sentence .

Here is the script

<?php
$strText = "This is a test";
$wordcount = count(explode(" ",$strText));
echo "There are $wordcount words in $strText";
?>

and here is the output as you would expect

There are 4 words in This is a test