Description

Category: Bug

Assignments in a conditional statement are sometimes the result of a typo. In many cases, instead of the assignment operator =, the equality operator == should be used. When comparing a variable and a non-variable expression, it is common practice to put the variable on the right-hand side of the equality operator, so that if the equality operator is erroneously replaced with the assignment operator, PHP will report a parse error immediately. This helps you avoid a big subset of this class of bugs.

Example

if ($a = 1) { // probably it was meant to be $a == 1 here
    
...
}