[thelist] PHP: is_numeric... that's the question...

Jay Blanchard jblanchard at pocket.com
Wed Jan 17 13:22:30 CST 2007


[snip]
Buuuut...
these are coming up as valid too?
F454354 / 4G64345 / L454345

$codeInt = is_numeric($getLast5Characters);
$codeAlpha = is_numeric($getFirst2Characters);
if (($codeLength == 7) && ($codeInt) && (!$codeAlpha)) {
	return "code valid";
} else {
	return "Code Invalid";
}
[/snip]

Looks to me like your if statement contains some faulty logic because

if(!$codeAlpha) will only check if $codeAlpha is FALSE, which it isn't.
Try echo is_numeric($getFirst2Characters) to see what the value is.



More information about the thelist mailing list