Simpler than you think
public static function getName() {
return __CLASS__;
}
However this won’t work if you extend MyClass.
class NewClass extends MyClass...
echo NewClass::getName(); // still says MyClass
You have to wait for php 5.3 and its “late static binding” feature for this to work properly. In the meantime, a hack based on [fphp]debug_backtrace[/fphp] seems to be the only choice.