1.2.1308. Use === null¶
It is faster to use === null than the function is_null().
This is a micro-optimisation. And being used frequently, and in loops, it may yield visible speed up.
<?php
// Operator === is faster
if ($a === null) {
}
// Function call is slow
if (is_null($a)) {
}
?>
See also is_null.
1.2.1308.1. Suggestions¶
Use === comparison instead of is_null
1.2.1308.2. Specs¶
Short name |
Php/IsnullVsEqualNull |
Rulesets |
All, Analyze, CE, CI-checks, Changed Behavior, php-cs-fixable |
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Features |
strict-comparison, null |
ClearPHP |
|
Available in |