Ultra simple...what on earth am I missing? [Solved]
Posted: Sun Mar 18, 2007 2:56 pm
Hi gang,
I've been up all night trying to finish a little project. Part of it involves a login script - nothing big or important, but I can't use pear modules due to client's paranoid sysadmin.
Anyhow, I'm having trouble with one ridiculously simple snippet of code. Any help deeply appreciated.
Now, for the dear life of me, I cannot get the conditional ("if") statement to trigger. 'supergrover' is one of the values echoed on the first line of the foreach loop, but the conditional just won't run.
If I replace $value in the conditional with $debugvar, it works fine. If I change the 'supergrover' value in the conditional to any other value in the $passwordarray['username'] array, the problem still occurs.
A var_dump of $passwordarray['username']:
Any suggestions really appreciated - I'm sure I'm missing something ridiculously simple, but I'm completely stumped.
Cheers,
- JB
I've been up all night trying to finish a little project. Part of it involves a login script - nothing big or important, but I can't use pear modules due to client's paranoid sysadmin.
Anyhow, I'm having trouble with one ridiculously simple snippet of code. Any help deeply appreciated.
Code: Select all
foreach ($passwordarray['username'] as $key=>$value) {
echo $value;
$debugvar = 'supergrover';
if ($value == 'supergrover') {
echo "You're in!";
}
}If I replace $value in the conditional with $debugvar, it works fine. If I change the 'supergrover' value in the conditional to any other value in the $passwordarray['username'] array, the problem still occurs.
A var_dump of $passwordarray['username']:
array(2) { [0]=> string(17) "supergrover
" [2]=> string(14) "testuser
" }
Any suggestions really appreciated - I'm sure I'm missing something ridiculously simple, but I'm completely stumped.
Cheers,
- JB