Reporting ErrorsTo report errors from an internal function, you should call the php3_error() function. This takes at least two parameters -- the first is the level of the error, the second is the format string for the error message (as in a standard printf() call), and any following arguments are the parameters for the format string. The error levels are: E_NOTICENotices are not printed by default, and indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script. For example, trying to access the value of a variable which has not been set, or calling stat() on a file that doesn't exist. E_WARNINGWarnings are printed by default, but do not interrupt script execution. These indicate a problem that should have been trapped by the script before the call was made. For example, calling ereg() with an invalid regular expression. E_ERRORErrors are also printed by default, and execution of the script is halted after the function returns. These indicate errors that can not be recovered from, such as a memory allocation problem. E_PARSEParse errors should only be generated by the parser. The code is listed here only for the sake of completeness. E_CORE_ERRORThis is like an E_ERROR, except it is generated by the core of PHP. Functions should not generate this type of error. E_CORE_WARNINGThis is like an E_WARNING, except it is generated by the core of PHP. Functions should not generate this type of error. E_COMPILE_ERRORThis is like an E_ERROR, except it is generated by the Zend Scripting Engine. Functions should not generate this type of error. E_COMPILE_WARNINGThis is like an E_WARNING, except it is generated by the Zend Scripting Engine. Functions should not generate this type of error. E_USER_ERRORThis is like an E_ERROR, except it is generated in PHP code by using the PHP function trigger_error(). Functions should not generate this type of error. E_USER_WARNINGThis is like an E_WARNING, except it is generated by using the PHP function trigger_error(). Functions should not generate this type of error. E_USER_NOTICEThis is like an E_NOTICE, except it is generated by using the PHP function trigger_error(). Functions should not generate this type of error. E_ALLAll of the above. Using this error_reporting level will show all error types. | ||||||||||
|