Take the 2-minute tour ×  Are there any way for me to use PHP to
parse information of a PHP file, something likes : what
functions/classes it has, which functions are built-in/user-
defined or how many variables are there....?  share|improve this
question More useful than just the raw token stream is a parser
class like pear.php.net/package/PHP_Parser (or even CodeSniffer)
which deciphers defined functions/variables. –  mario Mar 13 '11
at 2:34 add comment  1 Answer  up vote 3 down vote accepted  You
can use the function token_get_all() to parse PHP source.
$source = file_get_contents('my-file.php'); $tokens =
token_get_all($source); share|improve this answer There was also
some discussion about this here:
stackoverflow.com/questions/5068007/… –  Tom Gruner Mar 13 '11
at 2:20 add comment  Your Answer