Question

I'm profiling an app that has a boat load of functions in many files and I'm trying to isolate functions that don't get called ever.

Any ideas before I proceed?

Was it helpful?

Solution

I don't believe there is an easy way to do this. print_r(get_defined_functions()); in a file that can be included at the end of every file or in a global. Collect the output and do searches on all your files for function calls. This will isolate out your functions.

Or

Move all the functions to an include file, comment out the functions and then allow the application to error. As you get errors for those functions un-comment the functions to resolve the errors. At the end of all your checks you'll have a list of commented functions that aren't utilized.

Either way it's not easy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top