|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-11-18 23:31 UTC] jani@php.net
[2008-11-24 19:48 UTC] lbarnaud@php.net
[2009-01-28 23:06 UTC] jani@php.net
[2009-12-16 23:00 UTC] seld@php.net
[2009-12-23 10:27 UTC] kalle@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 25 23:00:01 2025 UTC |
Description: ------------ As the following lines are ok: $var = $var + 1; $var[trim($var2)] = ''; I expected PHP to first evaluate the $key-String ([$var]), then modify $var. So a line like: $var = 'a'; $var[$var] = 0; should work. Reproduce code: --------------- <?php $var = 'xxxxx'; $var[$var] = true; var_dump($var); ?> Expected result: ---------------- array(1) { ["xxxxx"]=> bool(true) } or a warning like: Warning: Cannot use a scalar value as an array Actual result: -------------- string(5) "1xxxx" Depending on what code was before it, or what was in $var before, the first character is not always '1'.