The conditional logic you first posted will always be true (play computer and try some values.) Either the first term will be true or the second term will be true, so the end result, due to or’ing the terms, will always be true.
Using negative logic should be avoided whenever possible. Negating the posted logic results in if ($s[2] ==“TO” && $s[2] ==“AND”) {, which makes it easier to see that the condition will never be met. A single array element/variable can never be both of those values at the same time.
If what you are doing is to detect if the array element is either ‘TO’ or ‘AND’, the logic would be if ($s[2] ==“TO” || $s[2] ==“AND”) {. The negative logic of this would be if ($s[2] !==“TO” && $s[2] !==“AND”) {.
A simpler way of testing if something is (is not) one of several values, is to make an array of the expected values and use in_array() -
[php]
// value is one of the expected values
if(in_array($s[2],[‘TO’,‘AND’])) {[/php]
[php]
// value is NOT one of the expected values
if(!in_array($s[2],[‘TO’,‘AND’])) {[/php]