PHP Syntax Check Multiple PHP files

Found this pretty cool link to how to syntax check multiple PHP files by passing the results of a find to php -l.

I’ve extended this and grepped out any files that pass syntax checking so you are just left with the errors. Here’s the full command in all its glory:

$ find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v "No syntax errors detected"