1.2.817. No More Curly Arrays

Only use square brackets to access array elements. The usage of curly brackets for array access is deprecated since PHP 7.4.

<?php

$array = [1,2,3];

// always valid
echo $array[1];

// deprecated in PHP 7.4
echo $array{1};

?>

See also Deprecate curly brace syntax and Deprecate curly brace syntax for accessing array elements and string offsets.

1.2.817.2. Connex PHP features

1.2.817.2.1. Suggestions

  • Always use square brackets to access particular index in an array

1.2.817.2.2. Specs

Short name

Php/NoMoreCurlyArrays

Rulesets

All, CE, CompatibilityPHP74

Exakat since

1.9.2

PHP Version

With PHP 8.0 and older

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Available in

Entreprise Edition, Community Edition, Exakat Cloud