PHP Mess Detector (PHPMD) is a tool for finding potential problems in your PHP code base. The tool outputs a detailed HTML report, which highlights the file name, line number, and a description of the potential problem detected.
Some examples of the kinds of problems the tool can find are:
You can find a full list of all of the rules applied by PHPMD during analysis on the PHPMD home site here:
Like all code analysis tools, PHPMD is no silver bullet but it will provide you with lots of hints on where you should be looking in your code for potential problems, particularly if you care about writing maintainable code.
Updated 2022 : note that the above post was originally published in 2010, but is left here for archival purposes.