function definedFunctionLocation ($function) {

if (!function_exists($function)) {

echo $function . ': Not Defined Function';

return;

}


$included_files = get_included_files();


array_shift($included_files);

foreach($included_files as $included_file) {

$handle = @fopen($included_file, "r");

if ($handle) {

   $line = 1;

   while (($buffer = fgets($handle, 4096)) !== false) {

if (0 != preg_match('/function[ \t]+'.$function.'[ \t]+\(.*\)/', $buffer, $buffer_match)) {

echo $included_file.':'.$line.' -> '.$buffer_match[0];

return;

}

$line++;

   }

   if (!feof($handle)) {

echo "Error: unexpected fgets() fail\n";

   }

   fclose($handle);

}

}


echo $function . ': Not Finded';

}

by 버려진Eye 2012. 4. 28. 18:44