[thelist] RE: PHP Noob-comparing array element

Bryan T talbot4 at bellsouth.net
Thu Jan 16 10:37:00 CST 2003


Aleem-THANK YOU!!! Problem solved.
rtrim did the trick.
Much gratitude to you!


>> // 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







More information about the thelist mailing list