sasori Posted August 12, 2008 Share Posted August 12, 2008 when using magic methods such as __get and __set is it ok to declare them with the use of modifiers such as private, public,protected and etc..? like for example, public function __get($property); public function __set($property, $value); or am i wrong? and the correct usage is like function _get() function _set() with no modifiers in the beginning of declaration.. (am confused about this magic stuff) Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 12, 2008 Share Posted August 12, 2008 If you're confused about magic methods, see here. They're going to need to be public, since they'll need to be called from outside the class. The default is public, so you don't need the public keyword, but it's probably a good habit to have. Quote Link to comment Share on other sites More sharing options...
sasori Posted August 12, 2008 Author Share Posted August 12, 2008 If you're confused about magic methods, see here. They're going to need to be public, since they'll need to be called from outside the class. The default is public, so you don't need the public keyword, but it's probably a good habit to have. ok cool, nice answer. thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.