A blog & community for non-professional web designers, programmers, webmasters, and other web savvies.

PHP Word Count

December 12, 2010 - 12:00am -- Thomas

This script will display how many words are in your string.

<?php
/*****************
--PHP Word Count
--More PHP Scripts at
--http://icecaves.net/tags/php
*****************/
$text = "Put your text here and php will calculate how many words your text contains. Put a backslash before any double quotes you use.";
$total_words = str_word_count($text, 0);
echo
"<b>String:</b> $text<br><b>Word Count:</b> $total_words";
?>
Code Preview: 
String: Put your text here and php will calculate how many words your text contains. Put a backslash before any double quotes you use.
Word Count: 23
Tags: 
Forum Board: 

Comments

dktpromo
dktpromo's picture
Puddle (?)
Rank Points: 0 (?)
Posts: 1
Status: Offline

How to jquery is useful in php?

@IceCaves on Twitter

    Stay Connected

    Twitter Facebook Tumblr Google+ Glaciallis Google RSS

    *Follow us on Twitter or Facebook to also follow minor site updates that don't make it to the homepage news.