Wilkes
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Validation function doesn't work (sort of...)
$a === $b Identical*TRUE* if $a is equal to $b, and they are
of the same type. (PHP 4 only)
Jonathan Wilkes wrote:
>That's not his problem, he is using "===" eua
item in the
array.
cheers,
Jonathan
-Original Message-
From: Philip Olson [mailto:[EMAIL PROTECTED]
Sent: 27 May 2003 17:03
To: Jason Lange
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Validation function doesn't work (sort of...)
When you found success in the loop you really should
Jonathan Wilkes wrote:
That's not his problem, he is using "===" euality check which just checks
the "type" of data, hence his code is returning TRUE for every item in the
array.
http://www.php.net/manual/en/language.operators.comparison.php
Not so -- the identical ("===") comparison operator che
Jason Lange wrote:
for ($i = 0; $i < $vCount; ++$i) {
if (($cryptUser === $validUser[$i]) &&
($cryptPass === $validPass[$i])) {
$retVal = true;
+ break;
} else {
$retVal = false;
}
}
retu
th type
and value. I'm 98% sure I described the exact problem
below.
Regards,
Philip
> -Original Message-
> From: Philip Olson [mailto:[EMAIL PROTECTED]
> Sent: 27 May 2003 17:03
> To: Jason Lange
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Validation function doesn
17:03
To: Jason Lange
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Validation function doesn't work (sort of...)
When you found success in the loop you really should
end the loop otherwise it will keep checking and will
yield results as you describe. For example:
while (1) {
if (so
When you found success in the loop you really should
end the loop otherwise it will keep checking and will
yield results as you describe. For example:
while (1) {
if (something) {
$foo = true;
break;
} else {
$foo = false;
}
}
When $foo = true, the loop ends,
Shouldn't your equality check be "==" instead of "===" ?
Also, try modifying your loop so that after the first correct match, it does
a return true;
that way, you don't need to process the entire loop
Hello all,
I've created this nice validation function which compares a submitted
username and password to an array of acceptable values. However, at the
moment it will only match the *last* key in the array. Even when I
/*know*/ that I typed in the correct values (typed them in Notepad and
cop
9 matches
Mail list logo