Skip to content

Instantly share code, notes, and snippets.

@technoknol
Created December 15, 2014 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technoknol/61169aa22b6e636a437d to your computer and use it in GitHub Desktop.
Save technoknol/61169aa22b6e636a437d to your computer and use it in GitHub Desktop.
Get where function is declared file name and line no.
<?php
// Get where function is declared file name and line number.
$r = new ReflectionFunction('selected'); // ReflectionFunction is a PHP in-built class
echo $file = $r->getFileName(); // getFileName() is inherited method.
echo $startLine = $r->getStartLine(); // getStartLine() is inherited method.
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment