xref: /php-uv/tests/100-uv_timer.phpt (revision 4332fe7a)
1--TEST--
2Check for uv_timer_init and uv_timer_start
3--FILE--
4<?php
5$loop = uv_default_loop();
6$timer = uv_timer_init();
7
8$i = 0;
9uv_timer_start($timer, 10, 10, function($timer) use (&$i) {
10    echo "count: {$i}" . PHP_EOL;
11    $i++;
12
13    if ($i > 3) {
14        uv_timer_stop($timer);
15        uv_unref($timer);
16    }
17});
18
19uv_run();
20
21echo "finished";
22--EXPECT--
23count: 0
24count: 1
25count: 2
26count: 3
27finished
28