What is strlen() in PHP?
The strlen() function in PHP is used to calculate the size of a string.
The illustration below shows the mathematical representation of the strlen() function.
Syntax
strlen(string)
Parameters
The strlen() function requires a string as a parameter.
Return value
This function returns the size of a string.
Code
<?phpecho("The size of string 'hello': ");echo(strlen("hello"));echo("\n");echo("The size of string 'educative': ");echo(strlen("educative"));?>