Loop won't keep, if not reference in object EvWatcher

Issue #22 invalid
Alex Sky
created an issue

Its work (reference $w)

$i = 0;

$w = new EvTimer(0, 1.0, function() use(&$i)
{
    $i++;
    echo "$i\r\n";
});

Ev::run();

Its not work (not reference $w)

$i = 0;

new EvTimer(0, 1.0, function() use(&$i)
{
    $i++;
    echo "$i\r\n";
});

Ev::run();

Comments (3)

  1. Log in to comment