Strlen
from PHPWiki - the free guide to PHP.
[edit] Description
strlen will return the length of the string on success or a 0 if the string is empty.
[edit] Parameters
| integer strlen (string input) |
[edit] Parameter Infos
| Parameter | PHP Version | Type |
| strlen | 4 or 5 | returns integer |
| input | 5 | string |
[edit] Examples
[edit] Example 1: The direct way
<?php echo strlen("Hello"); ?>
[edit] Output
5
[edit] Example 2: Using a variable
<?php $string = "ABCDEFG"; echo strlen($string); ?>
[edit] Output
7
[edit] Example 3: The use of spaces
<?php // spaces will count too echo strlen(" Abc 0 Abc "); ?>
[edit] Output
11
[edit] See also
- For more details on this function, visit its entry in the php manual.
