xxxxxxxxxx
$str = "Hello, world!";
$length = strlen($str);
echo $length; // Output: 13
xxxxxxxxxx
<?php
$str = 'abcdef';
echo strlen($str); // 6
$str = ' ab cd ';
echo strlen($str); // 7
?>
xxxxxxxxxx
<?php
$name = 'abcdef';
echo strlen($str); // 6
$string = ' ab cd ';
echo strlen($str); // 7
?>
xxxxxxxxxx
<?php
$str = 'abcdef';
echo strlen($str); // 6
$str = ' ab cd ';
echo strlen($str); // 7
?>
xxxxxxxxxx
<?php
$str = 'php';
echo strlen($str); // 3
$str = 's p a c e';
echo strlen($str); // 9
?>
xxxxxxxxxx
# IMPORTANT: The text must be in double-quotes in brackets
echo strlen ("Text goes here...");
xxxxxxxxxx
phpCopy<?php
$mystring = "This is my string";
echo("The string length in bytes is: ");
echo(strlen($mystring));
?>
xxxxxxxxxx
phpCopy<?php
$mystring = "This is my string";
echo("The string length in bytes is: ");
echo(mb_strlen($mystring));
?>