0

Possible duplicate:
When do/should I use __construct(), __get(), __set(), and __call() in PHP?

This is one area that I have not found any good answer. Can anyone explain to me why/how to use them correctly? Aren't they just a bad design decision?

Community
  • 1
  • 1
  • Voted to close: "exact duplicate". Please see http://stackoverflow.com/questions/250616/when-do-should-i-use-construct-get-set-and-call-in-php. – Andrew Hare Apr 15 '09 at 18:19

1 Answers1

2

I think the documentation explains it best. And it's called Overloading.

__set() is run when writing data to inaccessible members.

__get() is utilized for reading data from inaccessible members.

It also has some examples of using these.

Community
  • 1
  • 1
Ólafur Waage
  • 68,817
  • 22
  • 142
  • 198