The PHP function strlen can be used to find out how many characters are in a string. This is very useful for validating that there’s data in a string, and that a string isn’t larger than it should be.
$password="secret1";
if (strlen($password) <= 5)
{
echo("Passwords must be a least 5 characters long.");
}
else {
echo ("Password accepted.");
}
?>
Our Password Code will Return: Password accepted






