Skip to content

Instantly share code, notes, and snippets.

@m0veax
Created October 29, 2020 13:36
Show Gist options
  • Save m0veax/f63010cfea94a912544dddc7ce0f9820 to your computer and use it in GitHub Desktop.
Save m0veax/f63010cfea94a912544dddc7ce0f9820 to your computer and use it in GitHub Desktop.
Recursive PHP Syntax Check
<?php
$it = new RecursiveIteratorIterator( new RecursiveDirectoryIterator('.'));
$regx = new RegexIterator($it, '/^.*\.php$/i', // only matched text will be returned
RecursiveRegexIterator::GET_MATCH);
foreach ($regx as $file) {
$file = $file[0];
exec('php -l ' . $file); //check the syntax here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment