[php-src] Issue #9838: Numeric array keys that are specified as strings should not be juggled during iterations [ '2' => 'value' ] to [ 2 => 'value' ]

From: Date: Wed, 26 Oct 2022 21:40:03 +0000
Subject: [php-src] Issue #9838: Numeric array keys that are specified as strings should not be juggled during iterations [ '2' => 'value' ] to [ 2 => 'value' ]
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242689@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9838 Author: drnkwati ### Description The following code: ```php <?php foreach ([ '2' => 'value' ] as $key => $value) { var_dump($key === '2'); } ``` Resulted in this output: ``` boolean false ``` But I expected this output instead: ``` boolean true ``` Numeric array keys that are specified as string should not be automatically juggled during iterations thanks ### PHP Version PHP 8.0 ### Operating System macOS Ventura 13.0

« previous php.bugs (#242689) next »