Looks now better..

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@32304 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Egon Schmid 2000-09-09 01:25:58 +00:00
parent 9904027e99
commit 6547025696

View file

@ -103,14 +103,14 @@
<programlisting role="php">
// Send notification through the server log if we can not
// connect to the database.
if (!Ora_Logon($username, $password)) {
error_log("Oracle database not available!", 0);
if (!Ora_Logon ($username, $password)) {
error_log ("Oracle database not available!", 0);
}
// Notify administrator by email if we run out of FOO
if (!($foo = allocate_new_foo()) {
error_log ("Big trouble, we're all out of FOOs!", 1,
"operator@mydomain.com");
"operator@mydomain.com");
}
// other ways of calling error_log():
@ -148,94 +148,93 @@ error_log ("You messed up!", 3, "/var/tmp/my-errors.log");
<example role="php">
<title>Error Integer changes</title>
<programlisting role="php">
error_reporting(55); // PHP 3 equivalent to E_ALL ^ E_NOTICE
error_reporting (55); // PHP 3 equivalent to E_ALL ^ E_NOTICE
/* ...in PHP 4, '55' would mean (E_ERROR | E_WARNING | E_PARSE |
E_CORE_ERROR | E_CORE_WARNING) */
error_reporting(2039); // PHP 4 equivalent to E_ALL ^ E_NOTICE
error_reporting (2039); // PHP 4 equivalent to E_ALL ^ E_NOTICE
error_reporting(E_ALL ^ E_NOTICE); // The same in both PHP 3 and 4
error_reporting (E_ALL ^ E_NOTICE); // The same in both PHP 3 and 4
</programlisting>
</example>
Follow the links for the internal values to get their meanings:
<table>
<title><function>error_reporting</function> bit values</title>
<tgroup cols="2">
<thead>
<row>
<entry>constant</entry>
<entry>value</entry>
</row>
<row>
<entry>constant</entry>
<entry>value</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry>
<link linkend="internal.e-error">E_ERROR</link>
</entry>
</row>
<row>
<entry>2</entry>
<entry>
<link linkend="internal.e-warning">E_WARNING</link>
</entry>
</row>
<row>
<entry>4</entry>
<entry>
<link linkend="internal.e-parse">E_PARSE</link>
</entry>
</row>
<row>
<entry>8</entry>
<entry>
<link linkend="internal.e-notice">E_NOTICE</link>
</entry>
</row>
<row>
<entry>16</entry>
<entry>
<link linkend="internal.e-core-error">E_CORE_ERROR</link>
</entry>
</row>
<row>
<entry>32</entry>
<entry>
<link linkend="internal.e-core-warning">E_CORE_WARNING</link>
</entry>
</row>
<row>
<entry>64</entry>
<entry>
<link linkend="internal.e-compile-error">E_COMPILE_ERROR</link>
</entry>
</row>
<row>
<entry>128</entry>
<entry>
<link linkend="internal.e-compile-warning">E_COMPILE_WARNING</link>
</entry>
</row>
<row>
<entry>256</entry>
<entry>
<link linkend="internal.e-user-error">E_USER_ERROR</link>
</entry>
</row>
<row>
<entry>512</entry>
<entry>
<link linkend="internal.e-user-warning">E_USER_WARNING</link>
</entry>
</row>
<row>
<entry>1024</entry>
<entry>
<link linkend="internal.e-user-error">E_USER_NOTICE</link>
</entry>
</row>
<row>
<entry>1</entry>
<entry>
<link linkend="internal.e-error">E_ERROR</link>
</entry>
</row>
<row>
<entry>2</entry>
<entry>
<link linkend="internal.e-warning">E_WARNING</link>
</entry>
</row>
<row>
<entry>4</entry>
<entry>
<link linkend="internal.e-parse">E_PARSE</link>
</entry>
</row>
<row>
<entry>8</entry>
<entry>
<link linkend="internal.e-notice">E_NOTICE</link>
</entry>
</row>
<row>
<entry>16</entry>
<entry>
<link linkend="internal.e-core-error">E_CORE_ERROR</link>
</entry>
</row>
<row>
<entry>32</entry>
<entry>
<link linkend="internal.e-core-warning">E_CORE_WARNING</link>
</entry>
</row>
<row>
<entry>64</entry>
<entry>
<link linkend="internal.e-compile-error">E_COMPILE_ERROR</link>
</entry>
</row>
<row>
<entry>128</entry>
<entry>
<link linkend="internal.e-compile-warning">E_COMPILE_WARNING</link>
</entry>
</row>
<row>
<entry>256</entry>
<entry>
<link linkend="internal.e-user-error">E_USER_ERROR</link>
</entry>
</row>
<row>
<entry>512</entry>
<entry>
<link linkend="internal.e-user-warning">E_USER_WARNING</link>
</entry>
</row>
<row>
<entry>1024</entry>
<entry>
<link linkend="internal.e-user-error">E_USER_NOTICE</link>
</entry>
</row>
</tbody>
</tgroup>
</table>
@ -247,16 +246,16 @@ error_reporting(E_ALL ^ E_NOTICE); // The same in both PHP 3 and 4
error_reporting(0);
/* Turn off all reporting */
error_reporting(7); // Old syntax, PHP 2/3
error_reporting(E_ERROR | E_WARNING | E_PARSE); // New syntax for PHP 3/4
error_reporting (7); // Old syntax, PHP 2/3
error_reporting (E_ERROR | E_WARNING | E_PARSE); // New syntax for PHP 3/4
/* Good to use for simple running errors */
error_reporting(15); // Old syntax, PHP 2/3
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); // New syntax for PHP 3/4
error_reporting (15); // Old syntax, PHP 2/3
error_reporting (E_ERROR | E_WARNING | E_PARSE | E_NOTICE); // New syntax for PHP 3/4
/* good for code authoring to report uninitialized or (possibly mis-spelled) variables */
error_reporting(63); // Old syntax, PHP 2/3
error_reporting(E_ALL); // New syntax for PHP3/4
error_reporting (63); // Old syntax, PHP 2/3
error_reporting (E_ALL); // New syntax for PHP3/4
/* report all PHP errors */
</programlisting>
</example>
@ -330,12 +329,12 @@ error_reporting(E_ALL); // New syntax for PHP3/4
&lt;?php
// redefine the user error constants - PHP4 only
define(FATAL,E_USER_ERROR);
define(ERROR,E_USER_WARNING);
define(WARNING,E_USER_NOTICE);
define (FATAL,E_USER_ERROR);
define (ERROR,E_USER_WARNING);
define (WARNING,E_USER_NOTICE);
// set the error reporting level for this script
error_reporting(FATAL + ERROR + WARNING);
error_reporting (FATAL + ERROR + WARNING);
// error handler function
function myErrorHandler ($errno, $errstr) {
@ -474,8 +473,8 @@ Aborting...&lt;br&gt;
For example:
<informalexample>
<programlisting>
if (assert($divisor == 0))
trigger_error("Cannot divide by zero", E_USER_ERROR);
if (assert ($divisor == 0))
trigger_error ("Cannot divide by zero", E_USER_ERROR);
</programlisting>
</informalexample>
<note>
@ -517,7 +516,7 @@ if (assert($divisor == 0))
<para>
See also <function>error_reporting</function>,
<function>set_error_handler</function>,
<function>restore_error_handler</function>,
<function>restore_error_handler</function>, and
<function>trigger_error</function>
</para>
</refsect1>