strlen() – Finding length of a PHP string

PHP strings can be of any length, since there is no limits to the size of strings in PHP. The PHP strings can be specified using either single quote (ex. ‘This is my test string’) or using double quotes (ex. “my test string”).PHP has some in built string manipulation functions.

The strlen PHP string function is used to find the length of the given string.

Example :


$string = ‘Milap’;
echo strlen($string);

Output :

Another Example :

$string = ‘ Milap ‘;
echo strlen($string);


Another One :

$string = ‘ Mi l a p ‘;
echo strlen($string);

Output :

In php a "space" is countable as a part of the string & it is countable
in the lenght of the string.

I like to hear from you about this !!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s