strlen() function is used to find the number of characters in a string of text. It also includes the white spaces inside the string.
<?php
$str1 = 'Welcome to PHP Tutorial';
echo strlen($str1); // Outputs: 23
$str2 = ' Welcome to PHP Tutorial ';
echo strlen($str2); // Outputs: 28
?>
Tags: how to find string length in php php count specific characters in string php if strlen php length array php string functions php string length limit php strlen() function strlen php strlen() function
About Praveen Kumar
I am a fullstack web developer with a passion for SEO, creating stunning websites, and organic marketing. I am a perfectionist.
View all posts by Praveen Kumar