How can I convert callable (anonymous function) into a string for eval?
I'm trying to write unit tests in phpunit that use runkit to override methods. And in particular, runkit_method_redefine()
requires a string parameter that will be eval()
-called later.
I want to have syntax highlighting of my test code, so I don't want to write code inside of a string, so I want to do something like
deEval(function(){
return 1;
});
that would output
"return 1;"
How can this be done easily (for example without doing fopen of the source file, finding a source line, parsing etc.)?