1.2.203. Compared Comparison¶
Usually, comparison are sufficient, and it is rare to have to compare the result of comparison. Check if this two-stage comparison is really needed.
<?php
if ($a === strpos($string, $needle) > 2) {}
// the expression above apply precedence :
// it is equivalent to :
if (($a === strpos($string, $needle)) > 2) {}
?>
See also Operators Precedence.
1.2.203.1. Connex PHP features¶
1.2.203.1.1. Specs¶
Short name |
Structures/ComparedComparison |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |