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.

 
 

Share on Google+Share on Google+

PHP String Length

Ads

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

 

Advertisements

Ads

Posted on: February 24, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles