Inspectopedia Help

Dangerous array initialization

Reports dangerous array initializations (such as $arr[] = value).

This practice is discouraged because if $arr already contains some value (for example, a string from a request variable), then this value will stay in place and [] may actually stand for string access operator. It is always preferable to initialize a variable by direct assignment.

See Creating/modifying with square bracket syntax ( for details.

Inspection Details

Available in:

PhpStorm 2023.3, Qodana for PHP 2023.3



Last modified: 13 July 2023