Skip to content

Instantly share code, notes, and snippets.

@anytizer
Created November 30, 2013 07:36
Show Gist options
  • Save anytizer/7716395 to your computer and use it in GitHub Desktop.
Save anytizer/7716395 to your computer and use it in GitHub Desktop.
Finds out functions in files
<?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