From:             steve at oneniltrade dot com
Operating system: Linux
PHP version:      4.3.2
PHP Bug Type:     Feature/Change Request
Bug description:  Use of $$var and arrays

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)


-- 
Edit bug report at http://bugs.php.net/?id=24335&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24335&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24335&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24335&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24335&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24335&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24335&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24335&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24335&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24335&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24335&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24335&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24335&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24335&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24335&r=gnused

Reply via email to