PHP word count function | String str_word_count() | Hindi


PHP में बहुत सारे रेडीमेड (Readymade) function  होते हैं जिनका उपयोग करके बहुत से task को पूरा किया जाता हैं । ऐसे ही यदि आपको किसी स्ट्रिंग (String) से words को count कराना हैं तो PHP  में के str_word_count() functon (String word count function) का उपयोग कर सकते हैं । str_word_count() function के नाम से ही पता चल रहा हैं की इसके द्वारा किसी भी string के words को count ( गिना) जाता हैं । 

वर्ड काउंट इन हिंदी | PHP String Word count function in Hindi  

वर्ड काउंट (word count) एक ऐसा रेडीमेड function हैं जिसके द्वारा किसी भी string में कितने words हैं पता किया जा सकता है। 

साधारण हिंदी भाषा में समझे तो यदि आपके पास कोई paragraph हैं और आप चाहते हैं की इसके वर्ड को काउंट कैसे किया जाए आज कल इंटरनेट पर बहुत सारी वेबसाइट हैं जहां पर अपना text content डालने पर पता चल जाता हैं की इस कंटेंट में कितने वर्ड हैं । 

इस तरह की वर्ड काउंट की वेबसाइट पीएचपी (PHP) में बनाने के लिए हम str_word_count() function का उपयोग कर सकते है । 

चलिए PHP word count function को उदाहरण से समझते हैं। 

वर्ड काउंट का उदाहरण | Example of str_word_count() function 

उपर दिए गए उदाहरण में आप देख सकते है की किस तरह से वर्ड काउंट के द्वारा स्ट्रिंग में कितने words है काउंट करके echo कराया हैं । वर्ड काउंट फंक्शन को स्ट्रिंग फंक्शन (String function ) के नाम से जाना जाता है । 

<?php
$string="Learn PHP in Hindi";
$result =str_word_count($string);
echo $result; 
?>

Output-

4

इस तरह से PHP String word count function का उपयोग करके किसी भी String के words को count किया जा सकता हैं । 

 


Please Share
Techno Smarter Developer
Web & App Developer
Techno Smarter Developer
Need help with a website or app? We build scalable web & mobile solutions and help businesses turn ideas into working products. Get quick expert guidance.
Free consultation • Fast reply

Recommended Posts:-


Live Chat

Hello! How can we assist you today?