PHP strlen() function

The strlen() function return the lengrh of string

Syntax

strlen( string $string ) : int

Parameters

Parameter Name Descrption
$string Required, The input string.

Return Value

Return the length of the string, if the string is empty then 0.

strlen() examples

echo strlen('PHP String Length'); 
//17

echo strlen(' String ');  
//8

Related Functions

  • count(): Count all elements in an array, or something in an object