note 59867 added to control-structures.declare
| From: | warhogatwarhogdotnet at osu1 dot php dot net | Date: | Sun, 18 Dec 2005 20:39:30 +0000 |
| Subject: | note 59867 added to control-structures.declare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-100383@lists.php.net to get a copy of this message | ||
as i read about ticks the first time i thought "wtf, useless crap" - but then i discovered
some usefull application...
you can declare a tick-function which checks each n executions of your script whether the connection
is still alive or not, very usefull for some kind of scripts to decrease serverload
<?php
function check_connection()
{ if (connection_aborted())
{ // do something here, e.g. close database connections
// (or use a shutdown function for this
exit; }
}
register_tick_function("connection");
declare (ticks=20)
{
// put your PHP-Script here
// you may increase/decrease the number of ticks
}
?>
----
Manual Page -- http://www.php.net/manual/en/control-structures.declare.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59867
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59867&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59867&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59867&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59867&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59867&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59867&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59867&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59867&report=yes
Search -- http://master.php.net/manage/user-notes.php