Question

protected function _return()
{
   return 'something';
}

How to print content of method? I would like to echo return 'something'; as string...

Was it helpful?

Solution

You cannot do such a thing as getting the source-code of a method, from a running-code.

You'll have to cheat :

  • Find out in which PHP file this method is
  • Open that file
  • Parse it
    • using regex or stuff like that might be a way...
    • or you could work with the Tokenizer Functions -- a better way to manipulate PHP code !
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top