PHP __set and __get Magic methods
Object oriented programming principles encourage encapsulation, i.e. containing all the functionality inside a class. Usually this means member variables should be private or protected, one of the common ways to do this is with various set and get methods. In the case of a user class it may have setName, getName, setAge, getAge and so on. This can be time consuming to set up, change and maintain. The magic methods __set and __get provide a quick way to implement generic set and get methods.
- Visit Site:
- PHP __set and __get Magic methods
- Filed in:
-
PHP / Tutorials & Tips / Miscellaneous
- Platforms:
-




- Databases:
-
- Date Added:
- Aug 8, 2008
- Last Updated:
- Aug 8, 2008
License and Pricing Information
Other
Price: $0.00 USD
| Publisher site visits: | 252 |
|---|---|
| Average rating: | 0.00 |
| Total ratings: | 0 |
Publisher Info
- Author:
- Dougal Matthews
Other listings by this publisher
- Lazy loading with autoload and PHP!
- Design Patterns with PHP: The Singleton
- Analysing PHP Objects and Classes
- Object Creation and Manipulation
- JavaScript: Detecting Caps lock
- Sharing your Google reader shared items
- Creating RSS feeds with SimpleXML
- PHP __call and __callStatic Magic methods
- HTML DOM and easy screen scraping in PHP
