Configure your development environment to display all PHP warnings, notices and errors. This will help you code better and also help in catching potential bugs early in development phase.
You can change the error reporting level at runtime by adding the following code at the top of your PHP script:
<?php // Report all PHP errors. // Don't enable on production servers error_reporting(E_ALL); ?>
You can also control whether you want to display errors in the browser itself or whether you want to log the errors.
Note: Displaying errors is not recommended for production servers.