I've not been able to find any inexpensive tools to document all the vars/consts/functs/classes/includes in a PHP script, so I'm writing my own. (I use a lot of open source scripts that need to be modified. Plus, it would be nice to have a directory for my own projects.)
I've kludged one together using php string functions, finding all the constants, then traversing each line of the script, loading the line number in an array, then the includes/requires, then the variables, etc. This gets about 90% of what I want. If I were to improve it, though, I would probably have change the approach to dealing with the script character by character, just like the php compiler probably does. Anyone have a better idea how to solve this problem? I can't believe I have to invent this wheel...
I suppose there are programming environments that have this functionality built in, but I'm old school and low budget. And, yes, OO and tight functions eliminate the need to document most vars, but there is still need to see the include/require tree, document globals, see where all the instances of a class are used and how., etc.
It looks like my best bet is to use the built in Tokenizer (http://php.net/manual/en/ref.tokenizer.php) in php.
This ids variables, but processing is required to identify arrays, class ids, etc.