|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-07-25 13:44 UTC] laruence@php.net
-Status: Open
+Status: Not a bug
[2013-07-25 13:44 UTC] laruence@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Mon Jan 05 02:00:02 2026 UTC |
Description: ------------ If you try within a return construct to attach a variable to an array, the array will be overwriten by the value you tried to attach to it. Because the following examples work, it should also work with test script due to consistency. $ php -r 'function foo() { $intNumber = 0; return $intNumber + 1 + 2; } var_dump(foo());' int(3) $ php -r 'function bar() { $strText = "foo"; return $strText . "bar"; } var_dump(bar());' string(6) "foobar" Test script: --------------- $ php -r 'function foo() { $arrFoo = array(); return $arrFoo[] = "foo"; } var_dump(foo());' Expected result: ---------------- array(1) { [0]=> string(3) "foo" } Actual result: -------------- string(3) "foo"