Created
September 24, 2014 03:00
-
-
Save noodlehaus/3ea6b3f015c4e3ee3fa5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function function_stringify($func) { | |
| $ref = new ReflectionFunction($func); | |
| if ($ref->isInternal()) | |
| return '[internal]'; | |
| $top = $ref->getStartLine() - 1; | |
| $len = $ref->getEndLine() - $top; | |
| $src = implode('', array_slice(file($ref->getFilename()), $top, $len)); | |
| return $src; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment