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 constructor variables without using a return function? T> This is how I do it: T> class MyClass { T> function MyClass { T> $this->var1="1"; T> $this->var2="2"; T> } T> function GetVar1() { T> return $this->var1; T> } T> function GetVar2() { T> return $this->var2; T> } T> } T> Thanks Should be something like this: class MyClass { var $var1; vat $var2; function MyClass { $this->var1="1"; $this->var2="2"; } function GetVar1() { return $this->var1; } function GetVar2() { return $this->var2; } } $test = new MyClass(); echo $test->var1.'<br>'; echo $test->var2.'<br>'; This is not recommended by OOP buffs but it is perfectly legal. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php