Re: [PHP] Using a variable to call another variable [SOLVED]

2006-09-09 Thread Dave M G
Martin, Tedd, Robert, Christopher, Thank you all for your advice and examples. I had not been aware that it was possible to simply add another "$" ahead of the variable, to make a variable of the variable's name. And especially thank you for expressing an example in terms of a class and meth

Re: [PHP] Using a variable to call another variable

2006-09-09 Thread Martin Marques
On Sat, 09 Sep 2006 08:55:35 -0500, Christopher Weldon <[EMAIL PROTECTED]> wrote: > > class myClass { > private var $_001; > private var $_002; > private var $_003; > > public function access_var($var) { > return $this->$$var; > } > } > > $cs = new m

Re: [PHP] Using a variable to call another variable

2006-09-09 Thread Robert Cummings
On Sat, 2006-09-09 at 16:05 -0400, tedd wrote: > At 11:19 AM -0400 9/9/06, Robert Cummings wrote: > > > > > > Or something like that. < :-) > >> > >> $easy_peasyier = array("foo1" => 1, "foo2" => 2, "foo3" => 3); > >> > >> echo($easy_peasyier['foo1']); > > > >That's zero marks on any exam

Re: [PHP] Using a variable to call another variable

2006-09-09 Thread tedd
At 11:19 AM -0400 9/9/06, Robert Cummings wrote: > > Or something like that. < :-) $easy_peasyier = array("foo1" => 1, "foo2" => 2, "foo3" => 3); echo($easy_peasyier['foo1']); That's zero marks on any exam I ever wrote. You didn't properly read the business requirements that speci

Re: [PHP] Using a variable to call another variable

2006-09-09 Thread Robert Cummings
On Sat, 2006-09-09 at 08:44 -0400, tedd wrote: > At 12:10 AM -0400 9/9/06, Robert Cummings wrote: > >On Sat, 2006-09-09 at 12:57 +0900, Dave M G wrote: > >> PHP List, > >> > >> I have a list of variables: > >> > >> $001 > >> $002 > >> $003 > >> $004 > >> > >> And what I'd like to do is have

Re: [PHP] Using a variable to call another variable

2006-09-09 Thread Christopher Weldon
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 tedd wrote: > At 12:10 AM -0400 9/9/06, Robert Cummings wrote: >> On Sat, 2006-09-09 at 12:57 +0900, Dave M G wrote: >>> PHP List, >>> >>> I have a list of variables: >>> >>> $001 >>> $002 >>> $003 >>> $004 >>> >>> And what I'd like to do is hav

Re: [PHP] Using a variable to call another variable

2006-09-09 Thread tedd
At 12:10 AM -0400 9/9/06, Robert Cummings wrote: On Sat, 2006-09-09 at 12:57 +0900, Dave M G wrote: PHP List, I have a list of variables: $001 $002 $003 $004 And what I'd like to do is have a function which will select and return one of them. Something like: public function returnVa

Re: [PHP] Using a variable to call another variable

2006-09-08 Thread Robert Cummings
On Sat, 2006-09-09 at 12:57 +0900, Dave M G wrote: > PHP List, > > I have a list of variables: > > $001 > $002 > $003 > $004 > > And what I'd like to do is have a function which will select and return > one of them. Something like: > > public function returnVar($n) > { > return $(somehow n is

[PHP] Using a variable to call another variable

2006-09-08 Thread Dave M G
PHP List, I have a list of variables: $001 $002 $003 $004 And what I'd like to do is have a function which will select and return one of them. Something like: public function returnVar($n) { return $(somehow n is made to reference the name of the variable); } And then in later scripts I can