List all PHP variables from one directory

If you work on a big PHP project you might forget which variables you have already used. This script will list all variables and their occurences in the files with line numbers. It scans a complete directory including all subdirectories, but only php files (set $filter=false; to scan any file).

Change the file path at the beginning. The path must be accessible for your server (on default Apache cannot access any directory level above htdocs).

The script is very rough and has one major limitation: It scans the whole file for $-expressions no matter if html, javascript, text, php, string expressions or whatever. It is not intended to be perfect, just to forfil the purpose.
The output contains three parts:
Thanks for ideas about recursive directory scan at Lixlpixel.

This is the link to the script. Remove the txt extention to make it a php file. -> PHP