Debugging tools fall into two categories:
- Tools to diagnose issues when they arise and reveal problems
- Tools that prevent mistakes and errors from ever happening to begin with
The age old adage still applies: prevention is better than cure
Rather than manually adding
var_dumpstatements and reloading the page, you can add a breakpoint anywhere in your PHP code, execution will stop and you can see a stack trace, inspect (and modify) the values of all variables and objects or manually evaluate (test) a PHP expression.
There are a number of tools dedicated to analysing code and catching semantic mistakes, or pointing out problems in code.