modify a method/function at runtime
- by mononym
I've been looking at the php reflection methods, what i want to do is inject some code after the method is opened and before any return value, for example i want to change:
function foo($bar)
{
$foo = $bar ;
return $foo ;
}
And inject some code into it like:
function foo($bar)
{
//some code here
$foo = $bar ;
//some code here
return $foo ;
}
possible?