RE: [PHP] Anyway to access a class variable without using a return function?

2004-03-15 Thread Dave Starling
I think you could also do something like this: class MyClass { function MyClass { $this-var1=1; $this-var2=2; } function GetVar($var) { return $this-{$var}; } } $test = new MyClass(); echo $test-GetVar('var1').'br /'; echo $test-GetVar('var2').'br

RE: [PHP] Anyway to access a class variable without using a return function?

2004-03-15 Thread Marco Schuler
Hi! Am Mo, 2004-03-15 um 13.02 schrieb Dave Starling: I think you could also do something like this: class MyClass { function MyClass { $this-var1=1; $this-var2=2; } function GetVar($var) { return $this-{$var}; } } $test = new

Re: [PHP] Anyway to access a class variable without using a return function?

2004-03-15 Thread Tom Meinlschmidt
I mean using get_object_vars() is much better. and in the example I've seen there: you HAVE TO define all the variables you're using in a class scope. eg class myClass { var $var1; var $var2 = array(); function myClass($var) { $vars =get_object_vars($this); if (isset($vars[$var]))

Re: [PHP] Anyway to access a class variable without using a return function?

2004-03-15 Thread Marco Schuler
Hi Am Mo, 2004-03-15 um 14.10 schrieb Tom Meinlschmidt: I mean using get_object_vars() is much better. and in the example I've seen there: you HAVE TO define all the variables you're using in a class scope. eg class myClass { var $var1; var $var2 = array(); function

Re: [PHP] Anyway to access a class variable without using a return function?

2004-03-15 Thread Tom Meinlschmidt
thank, sure. function name should be myClassGetVar() :) /tom On Mon, 15 Mar 2004 14:49:55 +0100 Marco Schuler [EMAIL PROTECTED] wrote: Hi Am Mo, 2004-03-15 um 14.10 schrieb Tom Meinlschmidt: I mean using get_object_vars() is much better. and in the example I've seen there: you

Re: [PHP] Anyway to access a class variable without using a return function?

2004-03-15 Thread Marco Schuler
Am Mo, 2004-03-15 um 15.21 schrieb Tom Meinlschmidt: thank, sure. function name should be myClassGetVar() :) NoP! -- Regards Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Anyway to access a class variable without using a return function?

2004-03-14 Thread Tom Rogers
Hi, Monday, March 8, 2004, 3:42:30 PM, you wrote: T Hi List, T I have a class with a constructor that sets the variables and I currently T use functions to return each one. When using alot of variables in the T constructor i tend to have many return functions. Is there a way to access T the