onlinecode

How to find number of characters in a string in PHP

How to find number of characters in a string in PHP

In this post we will give you information about How to find number of characters in a string in PHP. Hear we will give you detail about How to find number of characters in a string in PHPAnd how to use it also give you demo for it if it is necessary.

Use the PHP strlen() function

You can simply use the PHP strlen() function to find the number of characters in a string of text. It also includes the white spaces inside the specified string.

Let’s take a look at the following example to understand how it basically works:

<?php
$my_str1 = 'The quick brown fox jumps over the lazy dog.';
echo strlen($my_str1); // Outputs: 44
 
$my_str2 = '    The quick brown fox jumps over the lazy dog. ';
echo strlen($my_str2); // Outputs: 49
?>

 

Hope this code and post will helped you for implement How to find number of characters in a string in PHP. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Exit mobile version