Skip to content

Instantly share code, notes, and snippets.

@noodlehaus
Created September 24, 2014 03:00
Show Gist options
  • Save noodlehaus/3ea6b3f015c4e3ee3fa5 to your computer and use it in GitHub Desktop.
Save noodlehaus/3ea6b3f015c4e3ee3fa5 to your computer and use it in GitHub Desktop.
<?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