php

How to find the length of a string in PHP

In this tutorial, we are going to see how to find the length of a string in PHP. You can use PHP’s strlen() function to get the length of a string. The strlen() function returns the size of a string on success and 0 if the string is empty.
 

How to find the length of a string in PHP
<?php
	$str = 'Welcom To StackHowTo!';
	
	echo strlen($str); 
?>

Output:

22
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 *