How to find the length of a string in PHP?

28 Views

How to find the length of a string in PHP?

Length of a string

There is a string function called strlen() which is used to find the length of a string. It accept a string returns the length of the given string. 

strlen(string);
 

Let's see an example:

 <?php

echo strlen("Hello world!");

?>

// output
This will produce following result −

12

 

Tags:-
PHP