Hi!
I got this code from here, i think it was "Ni Shurong" who gave it to me. The code works pretty good. Except i found that sending "asdas." into the function will return true...it should return false. What i am trying to do is check for valid chars. Only alpha and numeric. Can someone help me correct the code:
function isValid($strData, $bIncludeAlpha=false, $bIncludeNumber=false) { switch(true) { case $bIncludeAlpha && !$bIncludeNumber: $ptr = "/^[a-zA-Z]+/"; break; case !$bIncludeAlpha && $bIncludeNumber: $ptr = "/^[0-9]+/"; break; case $bIncludeAlpha && $bIncludeNumber: $ptr = "/^[a-zA-Z0-9]+/"; break; default: return false; } return preg_match($ptr, $strData); }
Thanx In Advance Jay
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php