|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-07-01 11:34 UTC] php at darkk dot net dot ru
Description:
------------
Converting from string to array using
$name['foobar'] = $name
does not work in some cases.
Reproduce code:
---------------
first:
function foobar($name) {
$name['anything'] = $name;
var_dump($name);
}
foobar("foobar");'
second:
$name = "foobar";
$name['anything'] = $name;
var_dump($name);
Expected result:
----------------
in both cases I expect to see:
array(1) {
["anything"]=>
string(6) "foobar"
}
Actual result:
--------------
first:
string(6) "oobar"
second:
string(6) "foobar"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 07:00:02 2025 UTC |
I've just found workaround for both issues: - $name['anything'] = $name; + $name = array('anything' => $name); I also can say that 5.2.0 and 5.2.3 are not affected (at least that's what people at #php @ freenode say).