Re: how to access class members

From: Date: Tue, 04 May 2010 13:44:21 +0000
Subject: Re: how to access class members
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-30071@lists.php.net to get a copy of this message
On Tue, May 4, 2010 at 3:02 PM, Alexander Schunk <aschunk@gmail.com> wrote: > Hello, > > i have a question: > > How to access class members? > > I have the following class definition: > > class Mitarbeiter{ > > public $name = 'meier'; > public $alter = '50'; > public $gehalt = '2000'; > public $abteilung = 'programmierung'; > > function printMember(){ > echo 'Name: ' . $this->public; > echo 'Alter: ' . $this->public; > echo 'Gehalt: ' . $this->public; > echo 'Abteilung: ' . $this->public; > } > this should be: function printMember(){ echo 'Name: ' . $this->name; echo 'Alter: ' . $this->alter; echo 'Gehalt: ' . $this->gehalt; echo 'Abteilung: ' . $this->abteilung; } Tyrael

« previous php.windows (#30071) next »