|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-06-26 05:24 UTC] mgf@php.net
[2003-06-26 06:39 UTC] steve at oneniltrade dot com
[2003-06-26 07:08 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 14:00:01 2025 UTC |
Description: ------------ I'm trying to use variable variables to build up an array in a recursive function, but this doesn't seem to be possible. the following short amount of code illustrates the problem. $str="array"; ${$str}[1]="one"; print_r ($$str); echo "<br>"; print_r ($array); .............Output.......... Array ([1]=>one) Array ([1]=>one) As expected, However $str="array[1]"; $$str="One"; print_r ($$str); echo "<br>"; print_r ($array); ............Output.......... One No output, ie $array has no value. Although $str has the value array[1], $$str is not the same as $array[1], as I believe it should be. (Or needs to be to get my function to work)