Why is there no facility to overload static properties in PHP?
- by Jon
Intro
PHP allows you to overload method calls and property accesses by declaring magic methods in classes. This enables code such as:
class Foo {
public function __get($name) { return 42; }
}
$foo = new Foo;
echo $foo->missingProperty; // prints "42"
Apart from overloading instance properties and methods, since PHP 5.3.0 we can also…