Debugging is inevitable. Whether you do it right or wrong, you will always end up trying to figure out what is wrong with your code. It does not matter how skilled you are, your code will contain bugs! That is a fact.
Sometimes these are easily spotted by just using a
die statement. I still use those sometimes, no shame on that. However, when code gets complex you need to have the right companion at your side. My companion is called PhpStorm.