Created
November 30, 2013 07:36
-
-
Save anytizer/7716395 to your computer and use it in GitHub Desktop.
Finds out functions in files
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 | |
header('Content-Type: text/plain'); | |
$path = '/home/USER/public_html'; | |
chdir($path); | |
$files = glob('*.php'); | |
$total = 0; | |
$catches = array(); | |
foreach($files as $f => $file) | |
{ | |
$fc = file_get_contents($file); | |
$catch = array(); | |
preg_match_all('#\s?function\ (.*?)[\r|\n]+#is', $fc, $catch); | |
if(isset($catch[1][0])) | |
{ | |
$catches[$file] = $catch[1]; | |
} | |
} | |
/** | |
* Create a unique list | |
*/ | |
foreach($catches as $c => $catch) | |
{ | |
$catches[$c] = array_unique($catch); | |
$total += count($catches[$c]); | |
} | |
print_r($catches); | |
echo 'Total functions: ', $total; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment