PHP String Length


 

PHP String Length

In this current tutorial we will study how to get the length of a string using strlen() function. Examples will help you to learn this in depth.

In this current tutorial we will study how to get the length of a string using strlen() function. Examples will help you to learn this in depth.

PHP String Length:

It is a common string operation to find out the length of a string, format of the function is:

int strlen ( string $string ):

In the above function length of the string is returned in integer format. It also includes blank spaces.

PHP String Length Example:

<?php

$string="This is a String";

$len=strlen($string);

echo $lenl;

?>

Output:

16

Example:

<?php

$string="RoseIndia";

$len=strlen($string);

echo $len;

?>

Output:

9

 

Ads