News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

David Sklar's Blog:
Runkit, "static", and inheritance
May 17, 2007 @ 08:43:00

David Sklar points out an issue that keeps coming up over and over again in the course of object-oriented applications - why the static keyword doesn't know about inheritance.

There are plenty of good reasons why PHP 5 works this way and it seems that in PHP 6 the static keyword will be able to be used in place of self to get the dynamic behavior a lot of folks are looking for. [...] All well and good once PHP 6 is done.

In the meantime, I was noodling around with runkit and came up with some glue that lets you do something like this.

In his runkit example uses a glue class called MethodHelper that uses various things (including some reflection) to manually look into the classes and find the static information.

A fun proof of concept, but not something (for efficiency reasons) you'd probably want to run on a busy production site.
0 comments voice your opinion now!
runkit inheritance static keyword php5 php6 oop runkit inheritance static keyword php5 php6 oop


blog comments powered by Disqus

Similar Posts

Denis de Bernardy\'s Blog: php4, php5 and php6 - thoughts and stats

DevShed: Enforcing Object Types in PHP - Using the Type Hinting Feature in PHP 5

Pierre-Alain Joye's Blog: PHP 5.2.7RC3 Released (Go test!)

Alison Holloway's Blog: PHP 5.2.2 Setup on Windows

Stubbles Blog: My wishlist for PHP 6, pt1: The 'object' type hint


Community Events





Don't see your event here?
Let us know!


podcast community extension opinion interview configure laravel conference introduction language voicesoftheelephpant composer install list version release symfony api series unittest

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework