Tuesday 25 March 2014

How To Know The Length of a String in PHP?

This is really very easy.

You have to use a function of PHP named strlen("Any Sentence") or strlen(a variable).

Here's a quick example



<?php

echo strlen("I am Learning PHP");

?>




Output:

17



Here's an example with variable



<?php

$string = "I am Learning PHP");

echo strlen($string);

?>




Output:

17



Easy, isn't It?

Follow Me On My Facebook Account

No comments:

Post a Comment