<HTML ><HEAD ><TITLE >Reporting Errors</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Extending PHP" HREF="phpdevel.html"><LINK REL="PREVIOUS" TITLE="Calling User Functions" HREF="calling-user-functions.html"><LINK REL="NEXT" TITLE="List of Function Aliases" HREF="aliases.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="calling-user-functions.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Appendix E. Extending PHP</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="aliases.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="phpdevel-errors" ></A >Reporting Errors</H1 ><P > To report errors from an internal function, you should call the <B CLASS="function" >php3_error()</B > 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 <A HREF="function.printf.html" ><B CLASS="function" >printf()</B ></A > call), and any following arguments are the parameters for the format string. The error levels are: </P ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-notice" ></A >E_NOTICE</H2 ><P > Notices 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 <A HREF="function.stat.html" ><B CLASS="function" >stat()</B ></A > on a file that doesn't exist. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-warning" ></A >E_WARNING</H2 ><P > Warnings 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 <A HREF="function.ereg.html" ><B CLASS="function" >ereg()</B ></A > with an invalid regular expression. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-error" ></A >E_ERROR</H2 ><P > Errors 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. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-parse" ></A >E_PARSE</H2 ><P > Parse errors should only be generated by the parser. The code is listed here only for the sake of completeness. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-core-error" ></A >E_CORE_ERROR</H2 ><P > This is like an E_ERROR, except it is generated by the core of PHP. Functions should not generate this type of error. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-core-warning" ></A >E_CORE_WARNING</H2 ><P > This is like an E_WARNING, except it is generated by the core of PHP. Functions should not generate this type of error. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-compile-error" ></A >E_COMPILE_ERROR</H2 ><P > This is like an E_ERROR, except it is generated by the Zend Scripting Engine. Functions should not generate this type of error. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-compile-warning" ></A >E_COMPILE_WARNING</H2 ><P > This is like an E_WARNING, except it is generated by the Zend Scripting Engine. Functions should not generate this type of error. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-user-error" ></A >E_USER_ERROR</H2 ><P > This is like an E_ERROR, except it is generated in PHP code by using the PHP function <A HREF="function.trigger-error.html" ><B CLASS="function" >trigger_error()</B ></A >. Functions should not generate this type of error. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-user-warning" ></A >E_USER_WARNING</H2 ><P > This is like an E_WARNING, except it is generated by using the PHP function <A HREF="function.trigger-error.html" ><B CLASS="function" >trigger_error()</B ></A >. Functions should not generate this type of error. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-user-notice" ></A >E_USER_NOTICE</H2 ><P > This is like an E_NOTICE, except it is generated by using the PHP function <A HREF="function.trigger-error.html" ><B CLASS="function" >trigger_error()</B ></A >. Functions should not generate this type of error. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="internal.e-all" ></A >E_ALL</H2 ><P > All of the above. Using this error_reporting level will show all error types. </P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="calling-user-functions.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="aliases.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Calling User Functions</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="phpdevel.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >List of Function Aliases</TD ></TR ></TABLE ></DIV ></BODY ></HTML >