PHP Tool: Dead Code Detection?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jeff00seattle
Forum Commoner
Posts: 66
Joined: Sat Feb 28, 2009 3:27 pm

PHP Tool: Dead Code Detection?

Post by jeff00seattle »

Hi

I have a project with a lot of PHP code, and I want to run a tool that will detect if it has any dead code (not called) and lists them so that I can remove.

Is there such a PHP tool?

Thanks

Jeff in Seattle
User avatar
Sofw_Arch_Dev
Forum Commoner
Posts: 60
Joined: Tue Mar 16, 2010 4:06 pm
Location: San Francisco, California, US

Re: PHP Tool: Dead Code Detection?

Post by Sofw_Arch_Dev »

A "profiler" would probably do the trick. I haven't used one for PHP, but they generally analyze your code and give statistics on your code files such as the amount of usage it gets, amount of memory it consumes, amount of time spent etcetera. This may do what you want.

Do a web search for PHP profiler. There are several available.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: PHP Tool: Dead Code Detection?

Post by Weirdan »

More specifically you need code coverage analysis tool. Xdebug can gather code coverage data, for example.
Post Reply