使用Reflection,在运行时更改PHP类和方法的内容?

This is for fun only, don't scream please.

I would like to rewrite the content of a class's methods at runtime (I mean, without modifying the file, only replacing/editing the code in memory), is that possible?

Using reflection, or anything else?

Don't close this question please, I'm looking for another answer than runkit.

Why not simply create a new class that inherits from the one you want to modify and overwrite it's methods?

<?php
class MySimpleXML extends SimpleXMLElement {
    public function themethodiwanttooverwrite() {
        //...
    }
}
?>

As long as the method isn't marked as final...