PHP Enforce Errors

When debugging code I always want to force PHP to display all the errors, including any warnings so I can make sure my code isn’t doing anything unexpected. Its something I do so often that I should know the two lines of code off the top of my head. If I really thought about it I probably do but sadly Google + Copy / Paste is actually quicker than typing it out. So as much for my own benefit as anyone elses, here are the two lines of code I use over and over:

ini_set('display_errors', '1');

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>