Re: public readonly variables

From: Date: Fri, 23 Apr 2010 16:21:16 +0000
Subject: Re: public readonly variables
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-304487@lists.php.net to get a copy of this message
On 23 April 2010 18:10, Ashley Sheridan <ash@ashleysheridan.co.uk> wrote: > I think for now I'll just resort to leaving it as a public variable. > I'll leave the specific set function for it in and just hope that is > used instead! As it's only me who'll be using it for the time being, I > can always yell at myself later if I forget! You're using a setter but a public variable? That's about the worst compromise, isn't it? Either go down the road of the public variable or the setter/getter (and in your case I would definitely recommend the latter). Also, __get/__set are fine, as long as you don't use them for everything (i.e. 5 magic calls per request will do very, very little to your app, whereas 1000 per request will have some significance on a site with lots of users). Regards Peter -- <hype> WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 </hype>

« previous php.general (#304487) next »