Google News
logo
PHP Program to Get the length of a string - strlen()
In PHP, `strlen()` is used to get the length of a string. It returns the number of characters in a string, including spaces and special characters.

Here's an example :
Program :
<?php
$string = "Welcome to Free Time Learn";
$length = strlen($string);
echo "The length of the string is: " . $length;
?>
Output :
The length of the string is: 26
Note that `strlen()` is a binary-safe function, which means that it can handle strings containing null bytes (\0) as well.