Home >>PHP String Functions >PHP strlen() Function
PHP strlen() function is used to get the length of a given input string. It takes a string as an input parameter and returns its length as output. It calculates the length of the given input string including all the whitespaces and special characters.
Syntax:
strlen($string);
Parameter | Description |
---|---|
string | This is a required parameter. This parameter defines the string to check. |
Here is an example of strlen() function in PHP:
<html> <body> <?php echo strlen("PHPTPOINT"); ?> </body> </html>
Here is an another example of strlen() function in PHP:
<html> <body> <?php $str = "Hello Everyone!! Welcome to PHPTPOINT.."; echo strlen($str); // whitespaces and special chars are also counted ?> </body> </html>