Hey there! Well in my php code I usually read the php.net documentation, it is very complete and great when you have problems in your code. Also looking in Google or forums such as stackoverflow. I used to have a teacher that said "coding is 80% google and 20% writing". I recommend to always have a php.ini file in your php projects, this will help you because when you do something wrong this will tell you the line where the problem is. Having a good text editor or IDE with their respective plugins and linters for PHP will tell you where the error is. Actually, I think it is matter of practice. The more you write, the more you will understand your code. The problems and errors are usually repetitive and you will get familiar with them, and you will remember how to solve them. Hope this was useful to you, and remember you can contact me whenever you have a PHP problem!