Inspectopedia Help

'foreach' variable overwrites already defined variable

Reports the keys and values in foreach loops that are assigned a non-primitive value before the foreach loop and are accessed after it. Such usages may unwillingly overwrite an already defined value and cause latent bugs.

Inspection Details

Available in:

PhpStorm 2023.3, Qodana for PHP 2023.3

Plugin:

PHP, 233.SNAPSHOT

Last modified: 13 July 2023