note 61185 added to function.register-shutdown-function
| From: | kenneth dot kalmer at gmail dot com | Date: | Fri, 27 Jan 2006 17:26:45 +0000 |
| Subject: | note 61185 added to function.register-shutdown-function | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102570@lists.php.net to get a copy of this message | ||
I performed two tests on the register_shutdown_function() to see under what conditions it was
called, and if a can call a static method from a class. Here are the results:
<?php
/**
* Tests the shutdown function being able to call a static methods
*/
class Shutdown
{
public static function Method ($mixed = 0)
{
// we need absolute
$ap = dirname (__FILE__);
$mixed = time () . " - $mixed\n";
file_put_contents ("$ap/shutdown.log", $mixed, FILE_APPEND);
}
}
// 3. Throw an exception
register_shutdown_function (array ('Shutdown', 'Method'), 'throw');
throw new Exception ('bla bla');
// 2. Use the exit command
//register_shutdown_function (array ('Shutdown', 'Method'), 'exit');
//exit ('exiting here...')
// 1. Exit normally
//register_shutdown_function (array ('Shutdown', 'Method'));
?>
To test simply leave one of the three test lines uncommented and execute. Executing bottom-up
yielded:
1138382480 - 0
1138382503 - exit
1138382564 - throw
HTH
----
Server IP: 72.21.46.202
Probable Submitter: 198.54.202.234 (proxied: 192.168.250.163, 165.146.111.232, 198.54.202.114)
----
Manual Page -- http://www.php.net/manual/en/function.register-shutdown-function.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61185
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61185&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61185&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61185&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61185&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61185&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61185&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61185&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61185&report=yes
Search -- http://master.php.net/manage/user-notes.php