I have been dying to see this issue resolved. I'm very much looking forward to the production release of PHP 5.3...
In my case I have been trying to do the following:
class A {
function __construct() {
echo "I was called by " . static::__CLASS__;
}
}
class B extends A {
function Foo() {
echo "I am class " . __CLASS__;
}
}
$b = new B; // Should echo "I was called by B"
$b->Foo(); // Should echo "I am class B"
At the moment I do the following workaround:
class A {
function __construct($child) {
echo "I was called by " . $child;
}
}
class B extends A {
function __construct() {
parent::__construct(__CLASS__);
}
function Foo() {
echo "I am class " . __CLASS__;
}
}
$b = new B; // Echos "I was called by B"
$b->Foo(); // Echo "I am class B"
As you can see, my current workaround has some overhead and is not as water-tight as the late static binding method.