1. Go to this page and download the library: Download initphp/fiber-loops 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/ */
initphp / fiber-loops example snippets
use InitPHP\FiberLoops\Loop;
$loop = new Loop();
$loop->defer(function () use ($loop) {
foreach (range(0, 5) as $value) {
echo $value . PHP_EOL;
$loop->next();
}
});
$loop->defer(function () use ($loop) {
foreach (range(6, 9) as $value) {
echo $value . PHP_EOL;
$loop->next();
}
});
$loop->run();
use InitPHP\FiberLoops\Loop;
$loop = new Loop();
$loop->defer(function () use ($loop) {
$loop->sleep(0.2);
foreach (range(0, 5) as $value) {
echo $value . PHP_EOL;
}
});
$loop->defer(function () use ($loop) {
foreach (range(6, 9) as $value) {
echo $value . PHP_EOL;
}
});
$loop->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.