PHP strlen () function
Examples
Function returns the string "Hello" length:
<?php
echo strlen("Hello");
?>
echo strlen("Hello");
?>
Running instance »
Definition and Usage
strlen () function returns the length of the string.
grammar
strlen( string )
参数 | 描述 |
---|---|
string | 必需。规定要检查的字符串。 |
technical details
return value: | If successful, the length of the string is returned if the string is empty it returns 0. |
---|---|
PHP version: | 4+ |
Update log: | Prior to PHP 5.3.0, the function of the array as a string Array, thus returning a string of length 5 and generate a E_NOTICE level error. |
More examples
Example 1
Returns the string "Hello World" length:
<?php
echo strlen("Hello world!");
?>
echo strlen("Hello world!");
?>
Running instance »
PHP String Reference