strlen()


কোন স্ট্রিং এ মোট কতটি character(ফাকা স্পেস সহ অক্ষর) আছে তা জানার জন্য ব্যবহার করা হয় strlen() ফাংশন।

ফাংশন প্রোটোটাইপ:

/**
 * It is used for getting string length
 * @param  [string] $string  [string to finds the length] 
 * @return [int]             [length of the string]
 */
int strlen ( string $string );

প্যারামিটার সমূহ:

প্যারামিটার ডাটা টাইপ বর্ণনা
Required $string String যে স্ট্রিং কে modified করতে চান

রিটার্ন ভেল্যু

স্ট্রিং এ মোট কতগুলি character আছে তা integer সংখ্যা হিসেবে রিটার্ন করে।

উদাহরন ১:

echo strlen("This is a string");

ফলাফল:
16

  যাচাই করে দেখুন

উদাহরন ২:

echo strlen("This       is  a     string");

ফলাফল:
27

  যাচাই করে দেখুন

উদাহরন ৩:

$str ="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptates impedit 
beatae provident corporis asperiores obcaecati odit laudantium! 
Rem quo perferendis modi ipsum, distinctio omnis inventore quasi 
unde, provident facere, cumque.";

echo strlen($str);

ফলাফল:
237

  যাচাই করে দেখুন

আরও জানতে দেখতে পারেন:

results matching ""

    No results matching ""