[thelist] PHP Noob-comparing array element

Aleem Bawany aleem.bawany at utoronto.ca
Wed Jan 15 18:18:01 CST 2003


> // I did that echo statement to make sure $info[1] is a
> reality-- // // it displays a nice complete list of all
> the email addresses // // BUT, the following comparison
> statement does not work:  //
>
>     if ($info[1] == $email) {
>        echo "The email address " . $email . " is already
>        subscribed.<br>\n"; exit;

I don't see how it couldn't work if $info[1] and $email are
actually the same. you say print them to screen to see that
they really are the same? Could be possible that you are
not seeing trailing whitespaces in one of the strings,
in which case you should try comparing using this:

if (rtrime($info[1]) == rtrim($email))

I would also convert these to strings to lower case before
comparing:

if (rtime(strtolower($info[1]))) == (rtrim(strtolower($email))))



aleem

[ http://members.evolt.org/aleem/ ]




More information about the thelist mailing list