A
Anonymous
Guest
I can't seem to figure out why the below IF statement is true. Based on the data in my array, the IF should be false and the subsequent code should not be executed. I am new to PHP, what am I missing??? (I've tested that the below values are what is actually in the array at the time of the IFs execution). I'm sure I've got some syntax error I don't know about. Are my use of 'and' & 'or' valid?
Relevent values from cardShape Array:
$cardShape[0] = 3;
$cardShape[6] = 3;
$cardShape[7] = 2;
if ((($cardShape[0] == $cardShape[6]) == $cardShape[7]) or
($cardShape[0] == 1 and $cardShape[6] == 2 and $cardShape[7] == 3) or
($cardShape[0] == 1 and $cardShape[6] == 3 and $cardShape[7] == 2) or
($cardShape[0] == 2 and $cardShape[6] == 1 and $cardShape[7] == 3) or
($cardShape[0] == 2 and $cardShape[6] == 3 and $cardShape[7] == 1) or
($cardShape[0] == 3 and $cardShape[6] == 1 and $cardShape[7] == 2) or
($cardShape[0] == 3 and $cardShape[6] == 2 and $cardShape[7] == 1))
{
echo "A Shape Match was found!";
}
Relevent values from cardShape Array:
$cardShape[0] = 3;
$cardShape[6] = 3;
$cardShape[7] = 2;
if ((($cardShape[0] == $cardShape[6]) == $cardShape[7]) or
($cardShape[0] == 1 and $cardShape[6] == 2 and $cardShape[7] == 3) or
($cardShape[0] == 1 and $cardShape[6] == 3 and $cardShape[7] == 2) or
($cardShape[0] == 2 and $cardShape[6] == 1 and $cardShape[7] == 3) or
($cardShape[0] == 2 and $cardShape[6] == 3 and $cardShape[7] == 1) or
($cardShape[0] == 3 and $cardShape[6] == 1 and $cardShape[7] == 2) or
($cardShape[0] == 3 and $cardShape[6] == 2 and $cardShape[7] == 1))
{
echo "A Shape Match was found!";
}