Using 'count()' as index for appending value to array
Reports the count($array)
calls that are used as an array index for appending an element to the array: $array[count($array)] = 42
. In such cases, it is recommended to use square bracket syntax ($array[] = 42
) instead, which adds no overhead of calling a function.
Inspection Details | |
---|---|
Available in: | PhpStorm 2023.3, Qodana for PHP 2023.3 |
Plugin: | PHP, 233.SNAPSHOT |
Last modified: 13 July 2023