php-ipc/examples/timers.php

16 lines
298 B
PHP
Raw Permalink Normal View History

2018-04-15 14:41:46 +00:00
<?php
require_once __DIR__."/../vendor/autoload.php";
use NoccyLabs\Ipc\Interop\Async\Timer;
$timer1 = new Timer(function () { echo "Hello "; });
$timer2 = new Timer(function () { echo "World! "; });
for ($n = 0; $n < 1000; $n++) {
if ($n == 500) {
unset($timer2);
}
usleep(10000);
}