How to find string length without using build-in function strlen in php

By Super Admin | Dec 02, 2020 | PHP
Share : Whatsapp

https://www.fundaofwebit.com/post/how-to-find-string-length-without-using-build-in-function-strlen

How to find string length without using build-in function strlen() in php


Here, in this article, we are going to learn about how to find the total string length withour using any predefined function or built-in function like strlen() function of php.

So guys, now let's begin with it:


<?php

$string = "ved";

$string_lenght = 0;
while($string[$string_lenght] != null){
$string_lenght++;
}

echo "Total String Length : ". $string_lenght;

?>


Output: 

Total String Length : 3


Thanks for reading.