You can essentially utilize the PHP strlen() capacity to get the length of a string. The strlen() function return the length of the string on progress, and 0 if the string is unfilled.
SOLUTION:
strlen
(PHP 4, PHP 5, PHP 7)
strlen - Calculate the size of a string
Description
strlen (string $ string): int
Returns the size of the string.
We should look this exemple:
Example
$str1 = 'Hello world!';
echo strlen($str1); // Outputs: 12
echo "<br>";
$str2 = ' Hello world! ';
echo strlen($str2); // Outputs: 17
if you want to improve the solution
comment to help the community
Post a Comment