1.2.349. Difference Consistence

There are two operators to check a difference : <> and !=.

The analyzed code has less than 10% of one of them : for consistency reasons, it is recommended to make them all the same.

It happens that != and <> are used depending on coding style and files. One file may be consistently using <>, while the others are all using !=. <> and != are the two only comparison operators that are identical.

<?php

// Both != and <> are used in the code
// When one of them is used less than 10%, it is reported as a consistence issue.
if ($a != $b) {

} elseif ($c <> $d) {

}

?>

See also Comparison Operators.

1.2.349.1. Specs

Short name

Structures/DifferencePreference

Rulesets

All, Preferences

Exakat since

0.11.1

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

operator

Available in

Entreprise Edition, Exakat Cloud