When the $_REQUEST['x'] is not 0 or '', it will be always correct condition
of your if. see the magic*.
-Original Message-
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 20, 2006 10:02 PM
To: Ross; php-general@lists.php.net
Subject: Re: [PHP] comparing a
At 12:43 PM +0100 6/20/06, Ross wrote:
>I have a quiz where the ansers are held in a array called $correct answers.
>When I compare the string
>
>if ($_REQUEST['x']= $correct_answers[$page-1]) {
>
>
>
>with a double == the answer is always correct with the single = it is always
>wrong.
>
>when I e
= is the assignment operator. It is not a comparison. == is the weak
equality comparator. === is the strong equality comparator.
On Tuesday 20 June 2006 06:43, Ross wrote:
> I have a quiz where the ansers are held in a array called $correct answers.
> When I compare the string
>
> if ($_REQUE
I have a quiz where the ansers are held in a array called $correct answers.
When I compare the string
if ($_REQUEST['x']= $correct_answers[$page-1]) {
with a double == the answer is always correct with the single = it is always
wrong.
when I echo out the posted answer and the value from the
4 matches
Mail list logo