Name
error_reporting
Synopsis
int error_reporting([int level])Sets the level of errors reported by PHP to
level and returns the current level; if
level is omitted, the current level of
error reporting is returned. The following values are available for
the function:
| Fatal runtime errors (script execution halts) |
| Runtime warnings |
| Compile-time parse errors |
| Runtime notices |
| Errors generated internally by PHP |
| Warnings generated internally by PHP |
| Errors generated internally by the Zend scripting engine |
| Warnings generated internally by the Zend scripting engine |
| Runtime errors
generated by a call to |
| Runtime warnings
generated by a call to |
| Direct PHP to suggest code changes to assist with forward compatibility |
| If a potentially fatal error has occurred, was caught, and properly handled, the code can continue execution |
| If enabled, warnings will be issued about deprecated code that will eventually not work properly |
| If enabled, any warning
message triggered by deprecated code can be user-generated
with the |
| All of the above options |
Any number of these options can be ORed (bitwise OR, |) together, so that errors in each of the
levels are reported. For example, the following code turns off user
errors and warnings, performs some actions, then restores the original
level:
<$level=error_reporting ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access