Horje
How to count number of words from sentence in PHP

It will count number of Words from a String.


How to count Words in PHP

See the Example.
index.php
Example: PHP
<?php
// PHP program to count number of
// words in a string 
  
$str = "I Love US"; 
  
// Using str_word_count() function to
// count number of words in a string
$len = str_word_count($str);

// Printing the result
echo $len; 
?>

Output should be:

How to count Words in PHP




php count

Type:
Develop
Category:
Web Tutorial
Sub Category:
PHP String Tutorial
Uploaded by:
Admin


Read Article
https://horje.com/learn/1434/reference