note 119287 added to function.unregister-tick-function
| From: | ElectricHeart at ya dot ru | Date: | Wed, 04 May 2016 21:14:39 +0000 |
| Subject: | note 119287 added to function.unregister-tick-function | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205428@lists.php.net to get a copy of this message | ||
You can unregister closure-function:
declare(ticks = 1000);
$startTime = microtime(true);
$tick = true;
$closure = function () use ($startTime, &$tick) {
if (((microtime(true) - $startTime) > 5) && $tick) {
$tick = false;
throw new \Exception('Time to run code left');
}
};
try {
register_tick_function($closure);
//do your code
$result = 1;
return $result;
} catch (\Exception $e) {
throw $e;
} finally {
unregister_tick_function($closure);
}
----
Server IP: 72.52.91.14
Probable Submitter: 217.107.127.127
----
Manual Page -- http://php.net/manual/en/function.unregister-tick-function.php
Edit -- https://master.php.net/note/edit/119287
Del: integrated -- https://master.php.net/note/delete/119287/integrated
Del: useless -- https://master.php.net/note/delete/119287/useless
Del: bad code -- https://master.php.net/note/delete/119287/bad+code
Del: spam -- https://master.php.net/note/delete/119287/spam
Del: non-english -- https://master.php.net/note/delete/119287/non-english
Del: in docs -- https://master.php.net/note/delete/119287/in+docs
Del: other reasons-- https://master.php.net/note/delete/119287
Reject -- https://master.php.net/note/reject/119287
Search -- https://master.php.net/manage/user-notes.php