| |
|
PHP String length counting |
How to count the length of a PHP string? This function is required to check some
form validation also where any input field is entered blank. PHP function strlen
does this work for us and returns number of characters inside the string
including blank space. If you want blank space to be removed then you can apply
string replace function str_replace to the string before applying strlen.
<?
$string="This is my string";
echo "Length of the string = ".strlen($string);
?>
| |
| Subscribe |
|
Submit your email address and receive
article and product notifications. Your email is safe with us.
|
|
|
|
|
|