Created
October 29, 2020 13:36
-
-
Save m0veax/f63010cfea94a912544dddc7ce0f9820 to your computer and use it in GitHub Desktop.
Recursive PHP Syntax Check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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