Showing posts with label calculate length in php. Show all posts
Showing posts with label calculate length in php. Show all posts
Check password length in php
Posted by Raj
Check password length in php
I have written function to check password length in php
<?php
$password="checkpassword";
$passwordCheck=passwordLength($passwod);
function passwordLength($pwd)
{
$pwdlen=strlen($pwd);//calculate length of password using strlen function
if($pwdlen<=4) //if length of password is less than 4 then password is too short.
{
return "Password too short!";
}
else if ($pwdlen>16) //if length of password is greater than 16 then password is too Long.
{
return "Password too Long!";
}
}
?>