Example
Return the length of the string "Hello":
html
<?php
echo strlen("Hello");
?>
Definition and Usage
The strlen() function returns the length of a string.
Syntax
text
strlen(string)
Parameter Values
| Parameter | Description |
|---|---|
| string | Required. Specifies the string to check |
Technical Details
| Return Value: | Returns the length of a string (in bytes) on success, and 0 if the string is empty |
|---|---|
| PHP Version: | 4+ |
More Examples
Example
Return the length of the string "Hello World":
html
<?php
echo strlen("Hello world!");
?>