Re: comparing a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



= 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  ($_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 answers arrray
> they are correct.
>
>
> echo "post equals".$_POST['x']."     corect answer
> is".$correct_answers[$page-1];
>
> Ross

-- 
Larry Garfield			AIM: LOLG42
larry@xxxxxxxxxxxxxxxx		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux