Different Methods to Show Error Messages In PHP
PHP Errors We use error functions to deal with error logging and error handling. Types of Errors: There are two types of errors:- Internal Error
- External Error
- Display the Error: This shows the error to the developer and/or user when the program is executed.
- Log the Error: Store the errors and review them from a textual log file
- Act on the Error: Each program will need a different type of action.
- Ignore the Error: This should continually be avoided.
- error_reporting()
- display_errors()
- log_errors()
- error_log string()
1 2 3 |
<?php error_reporting(0); ?> |
1 2 3 |
<?php error_reporting(E_ALL); ?> |
1 2 3 |
<?php ini_set("error_reporting", E_ALL); ?> |
1 2 3 |
<?php error_reporting(E_ERROR | E_WARNING | E_PARSE); ?> |
1 2 3 |
<?php error_reporting(E_ALL & ~E_NOTICE); ?> |