Re: Any way to make something happen when variable in class changes?

From: Date: Fri, 18 Oct 2002 09:51:30 +0000
Subject: Re: Any way to make something happen when variable in class changes?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120482@lists.php.net to get a copy of this message
Hi! If you´re using a class, it´s actually fairly simple. Don´t use $foo->myvariable = "value"; but rather define a function within the class like SetMyVariable($value) { $this->myvariable = $value; // Do something // Do something } Then, whenever you want to change the value, you use $foo->SetMyVariable("whatever"); Now, if you want to have this availyble for *all* of the classes variables, you add an extra parameter for the function and do a switch... Hope this helps! Adrian Slusarczyk "Leif K-Brooks" <eurleif@buyer-brokerage.com> schrieb im Newsbeitrag news:3DAF4581.5040500@buyer-brokerage.com... > Is there a way to make something happen when a variable is changed in a > function? I need to be able to do something like this for my class > which manipulates a record in the database. > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. > >

« previous php.general (#120482) next »