Skip to Content
Core PHP Programming, Third Edition
book

Core PHP Programming, Third Edition

by Leon Atkinson
August 2003
Intermediate to advanced
1104 pages
19h 27m
English
Pearson
Content preview from Core PHP Programming, Third Edition

6.11. User-Level Overloading

PHP 4 introduced the ability for module developers to overload the object-oriented syntax and create mappings into external object models, such as Java or COM. PHP 5 brings the power of object-oriented overloading syntax to PHP developers, allowing them to create custom behaviors for accessing properties and invoking methods.

User-level overloading is done by defining one or more of the following special methods: __get, __set, and __call. PHP calls these methods when the Zend Engine attempts to access a member and does not find it in the current scope.

In Listing 6.14 __get and __set relay all property accesses to the properties array. If necessary, you can implement any kind of filtering you wish. For example, the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming PHP, 3rd Edition

Programming PHP, 3rd Edition

Rasmus Lerdorf, Kevin Tatroe, Peter MacIntyre
Programming PHP

Programming PHP

Rasmus Lerdorf, Kevin Tatroe
Programming PHP, 2nd Edition

Programming PHP, 2nd Edition

Rasmus Lerdorf, Kevin Tatroe, Peter MacIntyre
Advanced PHP Programming

Advanced PHP Programming

George Schlossnagle

Publisher Resources

ISBN: 0130463469Purchase book