PHP Classes

File: examples/clearTimer.php

Recommend this page to a friend!
  Classes of Ahmad Mustapha   React PHP Timer Loop   examples/clearTimer.php   Download  
File: examples/clearTimer.php
Role: Example script
Content type: text/plain
Description: Example script
Class: React PHP Timer Loop
Call functions after a given time like JavaScript
Author: By
Last change:
Date: 3 years ago
Size: 314 bytes
 

Contents

Class file image Download
<?php
require(dirname(__DIR__, 3).'/autoload.php');

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

setLoop($loop);

setInterval(1, function($timer){
   
clearTimer($timer);
    echo
"I will run once.\n";
});

$timer = setTimeout(0.5, function(){
    echo
"I will never run.\n";
});
clearTimer($timer);

$loop->run();