cvs: phpdoc /en/reference/funchand/functions register-shutdown-function.xml
| From: | Kalle Sommer Nielsen | Date: | Wed, 15 Oct 2008 04:24:08 +0000 |
| Subject: | cvs: phpdoc /en/reference/funchand/functions register-shutdown-function.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-2241@lists.php.net to get a copy of this message | ||
kalle Wed Oct 15 04:24:08 2008 UTC
Modified files:
/phpdoc/en/reference/funchand/functions
register-shutdown-function.xml
Log:
Change examples to be somewhat better :)
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/funchand/functions/register-shutdown-function.xml?r1=1.17&r2=1.18&diff_format=u
Index: phpdoc/en/reference/funchand/functions/register-shutdown-function.xml
diff -u phpdoc/en/reference/funchand/functions/register-shutdown-function.xml:1.17
phpdoc/en/reference/funchand/functions/register-shutdown-function.xml:1.18
--- phpdoc/en/reference/funchand/functions/register-shutdown-function.xml:1.17 Tue Oct 14 03:07:19
2008
+++ phpdoc/en/reference/funchand/functions/register-shutdown-function.xml Wed Oct 15 04:24:08 2008
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.17 $ -->
+<!-- $Revision: 1.18 $ -->
<refentry xml:id="function.register-shutdown-function" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>register_shutdown_function</refname>
@@ -92,39 +92,16 @@
<programlisting role="php">
<![CDATA[
<?php
-// Find out whenever we're on PHP4 or not
-define('IS_PHP4', PHP_VERSION == 4);
-
-// Declare our class
-class Destructor
+function shutdown()
{
- // PHP4 style constructor, point it
- // to use the PHP5+ model
- function Destructor()
- {
- $this->__construct();
- }
-
- // PHP5 style constructor, register
- // the shutdown handler
- function __construct()
- {
- if(IS_PHP4)
- {
- register_shutdown_function(Array(&$this, '__destruct'));
- }
-
- echo 'Constructed', PHP_EOL;
- }
-
- // Destructor
- function __destruct()
- {
- echo 'Destructed', PHP_EOL;
- }
+ // This is our shutdown function, in
+ // here we can do any last operations
+ // before the script is complete.
+
+ echo 'Script executed with success', PHP_EOL;
}
-new Destructor;
+register_shutdown_function('shutdown');
?>
]]>
</programlisting>