Search code examples
phpdecoder

Print method content in PHP


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

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


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 !