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.
strlen(string)
The strlen() function requires a string as a parameter.
This function returns the size of a string.
<?phpecho("The size of string 'hello': ");echo(strlen("hello"));echo("\n");echo("The size of string 'educative': ");echo(strlen("educative"));?>