1.2.324. Curly-Bracketed Arrays Are Not Supported¶
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
// removed in PHP 8.3
echo $array{1};
?>
See also Deprecate curly brace syntax and Deprecate curly brace syntax for accessing array elements and string offsets.
1.2.324.2. Connex PHP features¶
1.2.324.2.1. Suggestions¶
Always use square brackets to access particular index in an array
1.2.324.2.2. Specs¶
Short name |
Php/NoMoreCurlyArrays |
Rulesets |
|
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 |