Display errors in PHP

To display all errors in PHP, use the following statement.

error_reporting(E_ALL);

Lots of error messagesThe above will ensure that all errors are reported including variables not being initiated properly. If you are a web developer and care about your work, you should always have error reporting turned on during development. One problem that can arise from having it on is that other components and modules that you didn't build will also display errors. Just ignore these and concentrate on your own work.

Sometimes even with the above statement, errors are not shown. This can cause a huge amount of frustration when it happens and you have no idea why. Basically it comes down to the following php setting which you need to turn on.

ini_set('display_errors', 1);

Now all your errors are shown during development so you can improve your skills.