ext-uv/examples/timer.php

18 lines
307 B
PHP
Raw Normal View History

2012-06-30 15:15:29 +02:00
<?php
$loop = uv_default_loop();
$timer = uv_timer_init();
$i = 0;
uv_timer_start($timer, 1000, 1000, function($stat) use (&$i, $timer, $loop){
2012-06-30 15:15:29 +02:00
echo "count: {$i}" . PHP_EOL;
$i++;
if ($i > 3) {
uv_timer_stop($timer);
uv_unref($timer);
}
});
uv_run();
echo "finished";