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....?
Asked
Active
Viewed 125 times
1 Answers
3
You can use the function token_get_all()
to parse PHP source.
$source = file_get_contents('my-file.php');
$tokens = token_get_all($source);

Andrew Moore
- 93,497
- 30
- 163
- 175
-
1There was also some discussion about this here: http://stackoverflow.com/questions/5068007/parsing-and-printing-php-code/ – Tom Gruner Mar 13 '11 at 02:20