The strlen() function is used to get the string length. It returns the length of the string on success. If the string is empty, 0 is returned.
Syntax
strlen(str)
Parameters
str − The string for which we want the length.
Return
The strlen() function returns the length of the string on success. If the string is empty, 0 is returned.
Example
The following is an example −
<?php echo strlen("Tom Hanks!"); ?>
Output
The following is the output −
10