How to count the length of string in PHP || PHP Examples

How to count the length of string in PHP

0 2919

To count the length of string or to check the length of string there is an inbuilt function used in PHP i.e strlen function (strlen() function). One parameter is used and it is mandatory for this function. It returns the value if true.


  echo strlen('Hello! Who Are You?');

Output: 19

You can also check the true condition.


 $get_string= strlen('Hello! Who Are You?');
   echo "Length is less than 20.";
	echo "Length is greater than 20.";

Output: Length is less than 20.

Best WordPress Hosting


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price

Leave a Reply

    Waiting for your comments