Share on Google+Share on Google+

PHP String Length

Advertisement
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

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

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.