[PHP] Re: comparing a string

2006-06-23 Thread Bill Guion
At 9:28 PM -0500 6/21/06, Rafael wrote: snip The only possible values of strcmp() are: 1, 0 & -1. Hmmm. My manual says: "Compares two strings; returns a number less than 0 if the first string is less than the second, 0 if the two strings are equal, and a number greater than 0 if the

[PHP] Re: comparing a string

2006-06-21 Thread Rafael
(inline --and last post on this thread) Adam Zey wrote: Rafael wrote: (inline) Adam Zey wrote: Rafael wrote: A single "=" it's an assignment, not a comparison; and though it sometimes work, you shouldn't compare strings with "==", but using string functions, such as strcmp()... or simi

[PHP] Re: comparing a string

2006-06-21 Thread Adam Zey
Rafael wrote: (inline) Adam Zey wrote: Rafael wrote: A single "=" it's an assignment, not a comparison; and though it sometimes work, you shouldn't compare strings with "==", but using string functions, such as strcmp()... or similar_text(), etc. This is PHP, not C. Operators such as =

[PHP] Re: comparing a string

2006-06-20 Thread Rafael
(inline) Adam Zey wrote: Rafael wrote: A single "=" it's an assignment, not a comparison; and though it sometimes work, you shouldn't compare strings with "==", but using string functions, such as strcmp()... or similar_text(), etc. This is PHP, not C. Operators such as == support strin

[PHP] Re: comparing a string

2006-06-20 Thread Adam Zey
Rafael wrote: A single "=" it's an assignment, not a comparison; and though it sometimes work, you shouldn't compare strings with "==", but using string functions, such as strcmp()... or similar_text(), etc. This is PHP, not C. Operators such as == support strings for a reason, peopl

[PHP] Re: comparing a string

2006-06-20 Thread Rafael
(inline) 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. A single "=" it's an assignment,