(PHP 4, PHP 5, PHP 7, PHP 8)

strlenGet string length


strlen(string $string): int

Returns the length of the given string.



The string being measured for length.

Return Values

The length of the string on success, and 0 if the string is empty.


Example #1 A strlen() example

strlen($str); // 6

$str ' ab cd ';
strlen($str); // 7



strlen() returns the number of bytes rather than the number of characters in a string.


strlen() returns null when executed on arrays, and an E_WARNING level error is emitted.

See Also

Here you can write a comment

Please enter at least 10 characters.
Loading... Please wait.
* Pflichtangabe
There are no comments available yet.

Technical SEO remains relevant

Technical SEO - What is it anyway? Technical SEO refers to the optimization of the technical aspects of your website. The goal is clear! ...


Autor : admin
Category: SEO & Online-Marketing

What's new in PHP 8.2.10

PHP 8.2.10 is one of the latest versions of PHP, which brings a number of improvements and new features. In this article we will discuss some of the outstanding new features and improvements in this version. ...


Autor : admin
Category: Software-Updates

Total Commander 11.00 (final) is available! What's new?

Total Commander, a popular file manager, has recently released its latest version, 11.00. With a variety of new features and corrections, this version offers users an enhanced and optimized experience. ...


Autor : admin
Category: Software-Updates

Publish a tutorial

Share your knowledge with other developers worldwide

Share your knowledge with other developers worldwide

You are a professional in your field and want to share your knowledge, then sign up now and share it with our PHP community

learn more

Publish a tutorial