#24335 [Bgs-Opn]: Use of $$var and arrays

2003-06-26 Thread steve at oneniltrade dot com
 ID:   24335
 User updated by:  steve at oneniltrade dot com
 Reported By:  steve at oneniltrade dot com
-Status:   Bogus
+Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Linux
 PHP Version:  4.3.2
 New Comment:

Hi

This may not be a 'bug' as such, but it was submitted as much as a
feature request as a bug report, it would be really useful if it did
work as i've described (or at least I think so.) Any chance of this
feature being added to a future version?


Previous Comments:


[2003-06-26 05:24:38] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You can only use variable variables for the name of the array itself --
you can't specify any subscripts using this mechanism.

I suggest you post the underlying problem you are trying to solve to
php-general to see if anyone has any alternative suggestions.



[2003-06-25 08:58:25] steve at oneniltrade dot com

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 this bug report at http://bugs.php.net/?id=24335edit=1



#24335 [NEW]: Use of $$var and arrays

2003-06-25 Thread steve at oneniltrade dot com
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=24335edit=1
-- 
Try a CVS snapshot: http://bugs.php.net/fix.php?id=24335r=trysnapshot
Fixed in CVS:   http://bugs.php.net/fix.php?id=24335r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=24335r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24335r=needtrace
Try newer version:  http://bugs.php.net/fix.php?id=24335r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=24335r=support
Expected behavior:  http://bugs.php.net/fix.php?id=24335r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=24335r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=24335r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=24335r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24335r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=24335r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=24335r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=24335r=gnused