PHP code example of pbergman / event-loop
1. Go to this page and download the library: Download pbergman/event-loop library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pbergman / event-loop example snippets
$loop = new Loop();
$loop->addCallback(function(CallbackWatcher $w){
if ($w->getLoop()->getTicks() === 3) {
$w->stopped();
}
});
$loop = new Loop();
$loop->addInterval(function(IntervalWatcher $w){
if ($w->getLoop()->getTicks() === 3) {
$w->getLoop()->stop();
}
});
$loop = new Loop();
$loop->addSignal(SIGCHLD, function(SignalWatcher $w, $signal){
echo "Got ", $signal, "\n";
});