Quantcast
Channel: Ataaso » php
Viewing all articles
Browse latest Browse all 2

How to Count the Total Words of String in PHP

$
0
0
Here is my simplest code for counting the words of any sentence CODE function count_words($val) { $val = explode(‘  ‘,$val); $val = count($val); return $val; } This function returns the total words of the sentence. How To Use $sentence = “I Love Ataaso.com”; $total_words = count_words($sentence ); echo $total_words; OUTPUT OUTPUT is 3.

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images