How to find String Length in PHP?

Use the strlen() function. It returns the length of a string. Spaces and special characters are counted too.

<?php
echo strlen("Hello world!");
?>

Output:

Tutorials Class - Output Window

12

strlen() counts bytes, so for non-English text (like Hindi) or emoji use mb_strlen(). See strlen() vs mb_strlen().


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.