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!";
}
}
?>
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
calculate length in php,
password length,
PHP,
PHP interview questions and answers,
strlen
.You can leave a response, or trackback from your own site.