Linux/PHP one liner - Syntax check all files.
Here’s a simple one liner you can use to syntax check all php files in your working directory.
find . -type f -name "*.php" -exec php -l {} \; | grep -v 'No syntax errors' For those not familiar with the programs used, it basically reads as…. Find all files that end in ‘.php’ and with each of those files run php -l. This is then put through a pipe to the grep -v, which filters out all files that are syntactically correct.
About
Dave Marshall is a Software Engineer living near Hull, England. He works on various personal projects and is the Technical Manager at Childcare.co.uk
Dave specialises in web application development for the LAMP stack, but always tries to choose a tool set that is most fit for purpose.
Dave is a Zend Certified Engineer and a Member of the British Computer Soceity.