1.2.408. Empty Array Detection

Empty arrays may be detected with different solutions. This analysis includes comparison to 0 with count, with ==, ===, != and !==, and comparison to empty arrays. Constants are not handled.

<?php

// comparison to empty array
$array === [];

// comparison of count()
count($array) === 0;

?>

1.2.408.1. Specs

Short name

Structures/ArrayCountTripleEqual

Rulesets

All, Changed Behavior, Preferences

Exakat since

2.4.7

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Available in

Entreprise Edition, Exakat Cloud