11th December 2009 - 13 minutes read time
Overloading in PHP describes the way in which properties and methods of an object can be dynamically created or accessed without having to define them first. Traditionally, the word overloading in programming is used to describe accessing object methods with the same name but with different parameters. It is not possible to do this in PHP as it will complain about methods having the same name, so the term describes calling a method or accessing a property that hasn't previously been set or is out of scope. In object orientated terms this means that the method or property is private.
Object Property Overloading
Property overloading allows you to access the property of an object through a method without having to write them first. It can also be used to access any properties that are inaccessible. There are two basic property overloading methods available, these are __set() and __get(), both contain a double underscore (_) in their name.