So I picked up a job that requires me to fix some broken code that another programmer wrote. It's a mess and is hard to read, but what really gets me is that I need to find a specific function that is buried somewhere in hundreds of php files.
If you were given the function name, say <?php print mystery_function(); ?>
, how would one go about tracking this down?
Aside from the brute method of ftping the entire site and having windows search through each file (which I am about to do), is there a way of sending a value to that function and producing an error that is traceable?
$reflection = new ReflectionFunction('mystery_function');
echo $reflection->getFileName();
http://www.php.net/manual/en/class.reflectionfunction.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With