mirror of
https://github.com/danog/ext-uv.git
synced 2024-12-02 09:27:58 +01:00
18 lines
305 B
PHP
18 lines
305 B
PHP
|
<?php
|
||
|
$loop = uv_default_loop();
|
||
|
$timer = uv_timer_init();
|
||
|
|
||
|
$i = 0;
|
||
|
uv_timer_start($timer, 10, 1000, function($stat) use (&$i, $timer, $loop){
|
||
|
echo "count: {$i}" . PHP_EOL;
|
||
|
$i++;
|
||
|
|
||
|
if ($i > 3) {
|
||
|
uv_timer_stop($timer);
|
||
|
uv_unref($timer);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
uv_run();
|
||
|
|
||
|
echo "finished";
|