PHP String Word Count – String Function

 
    <?php
$summary = <<< summary
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
summary;
   $words = str_word_count($summary);
   echo "Total words in summary: $words";
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.