ID: 48329 Comment by: carsten_sttgt at gmx dot de Reported By: ochronus at gmail dot com Status: Open Bug Type: Scripting Engine problem Operating System: Linux 2.6.23 PHP Version: 5.2.9 New Comment:
http://de.php.net/manual/en/language.types.array.php | If a key is the standard representation of an integer, | it will be interpreted as such (i.e. "8" will be | interpreted as 8, while "08" will be interpreted as "08"). Regards, Carsten Previous Comments: ------------------------------------------------------------------------ [2009-05-19 12:35:46] ochronus at gmail dot com Description: ------------ When accessing an array element with a string index which forms a number, it is inevitably converted to an integer. Reproduce code: --------------- <?php $a = array(); $b = '1234'; $a['x'] = 'whatever'; $a[$b] = 'whatever2'; foreach ($a as $key=>$value) { echo gettype($key)."\n"; } ?> Expected result: ---------------- string string Actual result: -------------- string integer ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48329&edit=1