== Why is this an issue? Boolean operators are used to combine conditional statements based on their value. In PHP, there are two different sets of operators to use for AND and OR: * ``++&&++`` / ``++||++`` * ``++and++`` / ``++or++`` The difference between these sets is the precedence, which specifies how "tightly" two expressions are bound together. Because ``++and++`` / ``++or++`` have a lower precedence than almost any other operator, using them instead of ``++&&++`` / ``++||++`` may not have the result you expect. === Noncompliant code example In both cases, the assignment has a higher precedence over the boolean operation. [source,php,diff-id=1,diff-type=noncompliant] ---- $resultAnd = true and false; // Noncompliant: $resultAnd == true $resultOr = false or true; // Noncompliant: $resultOr == false ---- === Compliant solution [source,php,diff-id=1,diff-type=compliant] ---- $resultAnd = true && false; // $resultAnd == false $resultOr = false || true; // $resultOr == true ---- == Resources === Documentation * https://www.php.net/manual/en/language.operators.logical.php[PHP Manual - Logical Operators] * https://www.php.net/manual/en/language.operators.precedence.php[PHP Manual - Operator Precedence] ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) === Message Replace "xxx" with "yy". ''' == Comments And Links (visible only on this page) === is related to: S3659 endif::env-github,rspecator-view[]