PHP Classes

File: vendor/react/event-loop/examples/02-periodic.php

Recommend this page to a friend!
  Classes of Stanley Aloh   Tic Tac Toe Multiplayer   vendor/react/event-loop/examples/02-periodic.php   Download  
File: vendor/react/event-loop/examples/02-periodic.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Tic Tac Toe Multiplayer
Manage the interactions ofTic-Tac-Toe game players
Author: By
Last change:
Date: 9 days ago
Size: 315 bytes
 

Contents

Class file image Download
<?php

require __DIR__ . '/../vendor/autoload.php';

$loop = React\EventLoop\Factory::create();

$timer = $loop->addPeriodicTimer(0.1, function () {
    echo
'tick!' . PHP_EOL;
});

$loop->addTimer(1.0, function () use ($loop, $timer) {
   
$loop->cancelTimer($timer);
    echo
'Done' . PHP_EOL;
});

$loop->run();