使用命令行打印所有php变量名


Print all php variables names using command-line

我在不同的php文件中有许多变量,我只想在我的终端中列出它们。

我猜命令以'cat file.php file2.php'开始,以'| sort | uniq'结束,但我未能找到匹配变量的模式,我不知道如何从其余行中剪切它们。

衷心感谢您

你可以试试:

egrep -o ''$'w+' *.php | sort -u

变量以$开头,后跟字母数字字符。