this regex would work too:
<?
$pw="asdf01";
function isValid($pw){
return preg_match("/^[a-z0-9]{3,}$/i",$pw);
}
echo (isValid($pw))?"Valid":"Not Valid";
?>
oh, to allow spaces in the pw just put a " "(space) after the 0-9
and to make the password 3-x chars long, change the {3,} to {3,max}