Recent changes Random page
GAMING
Technology
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
See more...

Strlen

from PHPWiki - the free guide to PHP.

Jump to: navigation, search

[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

count, mb_strlen

For more details on this function, visit its entry in the php manual.
Rate this article:
Share this article: