PHP code example of antibiotics11 / tick-manager
1. Go to this page and download the library: Download antibiotics11/tick-manager library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
antibiotics11 / tick-manager example snippets
use antibiotics11\TickManager\{TickHandler, TickManager};
declare(ticks = 1);
$start = time();
// Registering a custom handler to run every 1 tick.
TickManager::getManager()->addHandler(1, new TickHandler(function (&$start): void {
if (time() - $start >= 10) {
printf("10 seconds have passed\r\n");
exit(0);
}
}, $start));
while (true) {
printf("Hello, world!\r\n");
sleep(1);
}