Skip to content

Available predefined error constants for the php

Few days before, we have seen about PHP errors which are classified by the time of occurrence, recovery possibilities and etc. We can decide and control, which of these errors should be displayed at the time of its occurrence, by using predefined constants available in PHP represented as the error code or error constants.

Let us look into the following table to see the available error constants for the PHP errors classified based on the time of their occurrence.

Fatal ErrorWarningNoticeParse Error
E_ERROR
runtime error;
cannot be recovered;
will halt execution;
E_WARNING
runtime error;
non-fatal;
wont halt execution;
E_NOTICE
runtime error;
anticipate error caution;
wont halt execution;
E_PARSE
compile time error;
generated by parser;
E_CORE_ERROR
start up error;
generated by PHP core;
E_CORE_WARNING
start up non-fatal error;
generated by PHP core;
E_COMPILE_ERROR
compile time error;
generated by Zend Scripting Engine;
E_COMPILE_WARNING
compile time error;
generated by Zend Scripting Engine;
E_USER_ERROR
runtime error;
generated by user by trigger_error();
E_USER_WARNING
runtime non-fatal error;
generated by user by trigger_error();
E_USER_NOTICE
similar to E_NOTICE;
generated by user by trigger_error();
E_DEPRECATED
runtime error;
anticipate caution for deprecated methods;
E_USER_DEPRECATED
Like E_DEPRECATED;
generated by user by trigger_error();
error constants

Other PHP Error Constants

There are some more predefined error constants based on the possibility of error recovery or on providing suggestions to refine our code. These are,

  • E_RECOVERABLE_ERROR – This code is to catch the fatal error by using set_error_handler() function. It will not halt execution unless otherwise the error is not caught by the handler.
  • E_STRICT – This code will display suggestions or warnings if any, to change our code into standard and upgraded form.
  • E_ALL – This code is to display all the available error discussed above as a whole except E_STRICT. But, as of PHP version 5.4.0,  E_STRICT is also included with E_ALL.

These error constants can only be specified with a php.ini file to control the visibility of corresponding error. We can found any combination of their error constants with INI supported operators, that is limited with, bitwise (OR, XOR, AND, NOT) and boolean NOT. For example,

error_reporting = E_ALL | E_STRICT

Meaning that it allows to display the error whether it is either of the above classification including the warning notices that is generated for anticipating cautions to change the code as per the coding standards.

1 thought on “Available predefined error constants for the php”

  1. Sets the maximum length of log_errors in bytes. The value “0” can be used to not apply any maximum length at all. This length is applied to logged errors, displayed errors, and also to $php_errormsg (available since PHP 4.3)

  2. Ensuring the security of your company is crucial in today’s competitive marketplace. One of the the most effective ways to protect your business assets and monetary documents is by investing in a reliable commercial safe. Regardless of whether you’re housing money, important records, or sensitive data, a safe provides a critical layer of protection for your enterprise.

    When choosing a safe for commercial use, there are actually several elements to think about. First, evaluate your business’s safety requirements. Decide exactly what items require protection and the degree of protection needed.

    Subsequently, take into account the capacity and variety of safe needed for your company. Select a safe which suits within your business’s area while providing adequate room for valuables. Think about whether the safe requires additional features such as fireproofing or waterproofing.

    Additionally, inspect the security features of the safe. Search for features such as advanced locking mechanisms, sturdy construction, and tamper resistance. Take into account committing in a safe with additional protection measures such as biometric scanners or digital keypads.

    Finally, make sure the safe fits inside your company’s budget. Establish a realistic budget based on your protection necessities and explore choices that match within your financial constraints.

    In conclusion, picking the appropriate safe for your enterprise is critical for protecting your assets. By appraising your protection necessities, considering the dimensions and type of safe needed, looking into safety measures, and fixing a budget, you can ensure optimal protection for your business.

    Scottsdale safe clearance sale – https://mercurylock.com/safes

    Comment awaiting moderation.

Leave a Reply

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