Internal Static Call

../_images/internal_static_call.png

Trap of the day: one of the calls in bar() generates a ‘Non-static method a::foo() cannot be called statically’ error.

Which one? It is the d::foo(). All other calls are made within the C class : internal calls may use static or normal syntax, while external calls must use the correct call syntax. This allows calls like ‘parent::__construct()’.

When the call to bar() is made with ‘(new d)’, the ‘d::foo()’ works again.

See Also

PHP Error Messages

PHP Features