PHP code example of pisc / genflow
1. Go to this page and download the library: Download pisc/genflow 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/ */
pisc / genflow example snippets
namespace MyNamespace;
use function Pisc\GenFlow\gen;
function myGenerator()
{
yield 1;
yield 2;
yield 3;
}
gen(myGenerator())
->map(fn ($item) => $item * 2)
->filter(fn ($item) => $item < 5)
->toArray(); // [2, 4]