PHP strlen() Function
Definition
The strlen() function takes a string and returns the number of characters in it.
Syntax
PHP strlen() Function has the following syntax.
int strlen ( string str )
Parameter
str
is the string value to check.
Return
PHP strlen() Function returns the length of a string.
Example
Get the string length
<?PHP
print strlen("Foo") . "\n";
print strlen("Hi from java2s.com!") . "\n";
?>
For multibyte strings we should be measured with mb_strlen()
.
The code above generates the following result.