PHP code example of dkulyk / sequence
1. Go to this page and download the library: Download dkulyk/sequence 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/ */
dkulyk / sequence example snippets
DKulyk\Sequence\Sequence;
function fibonacci(&$value, $a = 1, $b = 2)
{
$value = $a;
return function (&$v) use ($a, $b) {
return fibonacci($v, $b, $a + $b);
};
}
$i = (new Sequence('fibonacci'))
->limit(10);
foreach ($i as $k => $v) {
echo $k, ' => ', $v, PHP_EOL;
}