Friday 24 July 2015

Simple PHP Code Debugging



Each beginning (and more advanced) PHP coder will fail because of errors while writing PHP code. This post will teach you some simple things about how you can find those errors in your PHP script. By default some errors will not show up on your web server!


Try the examples from the PHP manual 


The PHP manual is one of the best manuals I’ve ever read, each function is indexed and contains comments and examples from users. Often you will find exact the code snippet you need. Tip! Just add the function name behind the domain for a quick access like: http://www.php.net/foreach

 In most cases the PHP configuration does not allow to to show the errors in the production environment. Enable (temporary) a full error report with this two directives inside your .htaccess file. Don’t do this on a busy website, test your code on a test location first!