Description Edit

strlen will return the length of the string on success or a 0 if the string is empty.

Parameters Edit

{{{returns}}} strlen (string input)

Parameter Infos Edit

Parameter PHP Version Type
strlen 4 or 5 returns integer
input 5 string

Examples Edit

Example 1: The direct way Edit

echo strlen("Hello");

Output Edit


Example 2: Using a variable Edit

$string = "ABCDEFG";
echo strlen($string);

Output Edit


Example 3: The use of spaces Edit

// spaces will count too
echo strlen(" Abc 0 Abc ");

Output Edit


See also Edit

count, mb_strlen

For more details on this function, visit its entry in the php manual.