php

How to count the number of characters in a string in PHP

In this tutorial, we are going to see how to count the number of characters in a String in PHP. You can use strlen() function in PHP to find the number of a characters in a String. It also includes spaces inside the String.
 

How to count the number of characters in a string in PHP
<?php
	$str = 'Welcom to StackHowTo';
	echo strlen($str); // Sortie: 21
?>

Output:

21
[st_adsense] mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *