O'Reilly logo

PHP 5 Power Programming by Derick Rethans, Stig Sæther Bakken, Andi Gutmans

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.2. Overloading Capabilities

In PHP 5, extensions written in C can overload almost every aspect of the object syntax. It also allows PHP code to overload a limited subset that is most often needed. This section covers the overloading abilities that you can control from your PHP code.

4.2.1. Property and Method Overloading

PHP allows overloading of property access and method calls by implementing special proxy methods that are invoked if the relevant property or method doesn't exist. This gives you a lot of flexibility in intercepting these actions and defining your own functionality.

You may implement the following method prototypes:

function __get($property)
function __set($property, $value)
function __call($method, $args)

__get is passed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required