[PHP] Accessing Variables by Name

2002-05-14 Thread Steven Walker

Hi,

I couldn't find this in the documentation or on marc... Is there a way 
to access a variable by name using a string value? For example:

$myvariable = 10;
$stringdata = myvariable;
$[$stringdata] == $myvariable;

Obviously the last line is invalid, but is there a way to do this? I 
know about associative arrays, but they do not solve my particular 
problem. TIA.

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Accessing Variables by Name

2002-05-14 Thread Philip Olson

These are called variable variables, and can 
be read about here:

 http://uk.php.net/manual/en/language.variables.variable.php

Replace your [ ] with { } and you'll be good 
to go.

Regards,
Philip Olson


On Tue, 14 May 2002, Steven Walker wrote:

 Hi,
 
 I couldn't find this in the documentation or on marc... Is there a way 
 to access a variable by name using a string value? For example:
 
 $myvariable = 10;
 $stringdata = myvariable;
 $[$stringdata] == $myvariable;
 
 Obviously the last line is invalid, but is there a way to do this? I 
 know about associative arrays, but they do not solve my particular 
 problem. TIA.
 
 Steven J. Walker
 Walker Effects
 www.walkereffects.com
 [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Accessing Variables by Name

2002-05-14 Thread Miguel Cruz

On Tue, 14 May 2002, Steven Walker wrote:
 I couldn't find this in the documentation or on marc... Is there a way 
 to access a variable by name using a string value? For example:
 
 $myvariable = 10;
 $stringdata = myvariable;
 $[$stringdata] == $myvariable;
 
 Obviously the last line is invalid, but is there a way to do this?

$$stringdata = $myvariable;

   http://php.net/manual/en/language.variables.variable.php

 I know about associative arrays, but they do not solve my particular
 problem.

Really?

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php