PHP string length | strlen() function | Hindi


PHP में readymade functions की भरमार हैं जिसके द्वारा बहुत सारे कामों को पूरा किया जा सकता है। इस tutorial में हम PHP string length function : strlen() के बारे सीखेंगे । 

String को हैंडल करने के लिए पीएचपी (PHP) में बहुत सारे string functions बनाये गए हैं। उनमें से स्ट्रिंग लेंथ (strlen ) एक string funcction हैं जिसके द्वारा string की length को प्राप्त किया जाता है।  

स्ट्रिंग लेंथ function in Hindi | strlen() 

strlen() फंक्शन वह फंक्शन हैं जिसके द्वारा किसी भी स्ट्रिंग की लेंथ को प्राप्त किया जा सकता हैं । 

साधारण हिंदी भाषा में समझे तो यदि आपके पास कोई कोई परग्राफ  (paragraph-content) हैं या कोई word हैं या एक साथ कई वर्ड हैं एक स्ट्रिंग (many words in a string)  में। ओर आप उसके कितने characters हैं पता करना चाहते हैं तब वहां पर string length function का उपयोग किया जा सकता हैं । किसी भी string में कितने characers (Length of a string) हैं यह प्राप्त करने के लिए स्ट्रिंग लेंथ का उपयोग किया जाता हैं । 

चलिए उदाहरणों से स्ट्रिंग लेंथ को समझते है।  

स्ट्रिंग लेंथ फंक्शन के उदाहरण  | Examples of strlen() function 

<?php
$string="Learn";
$result =strlen($string);
echo $result; 
?>

Output:-

5

उपर दिए कई उदाहरण में हमने एक word लिया हैं । इस उदाहरण को रन करने पर इस वर्ड में कितने कैरेक्टर्स (characerts) हैं दिखाई देते हैं । 

चलिए एक और उदाहरण से समझते हैं । 

<?php
$string="I am learning PHP string in Hindi";
$result =strlen($string);
echo $result; 
?>

Output:-

33

उपर दिए गए उदाहरण में हमने एक लाइन ली है और स्ट्रिंग वेरिएवल ($string) को  strlen() फंक्शन में as a argument दिया है। जिसके द्वारा हम स्ट्रिंग की लेंथ (Length of a string ) मिल जाती हैं । ध्यान दे स्ट्रिंग लेंथ बीच में आए spaces को भी काउंट करता हैं । 

इस तरह से किसी भी string की length या कह सकते हैं string characters को find करने के लिए PHP strlen() function का उपयोग किया जा सकता हैं


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:-

Previous Posts:-

Featured Items:-


Payment form by PayUmoney gateway with GST invoice,email | PHP software

$38



Result management system with Marksheet in PHP website | PHP Scripts

$39



Ecommerce system in PHP website | Digital Ecommerce Shop web app

$66





0 Comment







Live Chat

Hello! How can we assist you today?