echo validatePIN("1234")."\n";
echo validatePIN("12345")."\n";
echo validatePIN("123456")."\n";
echo validatePIN("")."\n";
function validatePIN($pin){
$len=strlen($pin);
if (strlen($pin)!=4 && strlen($pin)!=6){
return "PIN is invalid";
}
for ($i=0; $i<$len; $i++)
$ASCII=ord($pin[$i]);
if (!(47<$ASCII && $ASCII<58)){
return "PIN is invalid";
}
return "PIN is valid";
}