|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-06-14 11:29 UTC] dr dot diesel at seznam dot cz
[2007-06-14 11:45 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 08:00:01 2025 UTC |
Description: ------------ Code snippet says everything: $arrname="my_array"; $$arrname = array("test","test2"); var_export($$arrname) outputs: array ( 0 => '204', 1 => '205', ) var_export($$arrname[0]) outputs: NULL $test=$$arrname; var_export($test) outputs: array ( 0 => '204', 1 => '205', ) var_export($test[0]) outputs:'204' Reproduce code: --------------- $arrname="my_array"; $$arrname = array("test","test2"); var_export($$arrname); var_export($$arrname[0]); $test=$$arrname; var_export($test); var_export($test[0]); Expected result: ---------------- $arrname="my_array"; $$arrname = array("test","test2"); var_export($$arrname) outputs: array ( 0 => '204', 1 => '205', ) var_export($$arrname[0]) outputs: >>>>>>>>'204'<<<<<<<<< $test=$$arrname; var_export($test) outputs: array ( 0 => '204', 1 => '205', ) var_export($test[0]) outputs:'204' Actual result: -------------- $arrname="my_array"; $$arrname = array("test","test2"); var_export($$arrname) outputs: array ( 0 => '204', 1 => '205', ) var_export($$arrname[0]) outputs: NULL $test=$$arrname; var_export($test) outputs: array ( 0 => '204', 1 => '205', ) var_export($test[0]) outputs:'204'