Using a PHP extension

Runkit is a a PECL extension that allows you redefine functions:

function testme()
{
  echo "Original Testme Implementation\n";
}
testme(); // Original Testme Implementation
runkit_function_redefine('testme','','echo "New Testme Implementation\n";');
testme(); // New Testme Implementation

It's very cool, however it's a little impractical: you have to recompile your PHP executables adding the flag --enable-runkit=classkit.
This means that you (and you your collaborators that have to run tests) will have to rebuild all the PHP versions you have in your dev machine.

That's not very funny...