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