<?php
function fib() {
[$x, $y] = [0, 1];
while (true) {
yield $x;
[$x, $y] = [$y, $x + $y];
}
}
for ($f = fib(), $i = 0; $i < 10; $i++) {
echo $f->current() . PHP_EOL;
$f->next();
}
To embed this project on your website, copy the following code and paste it into your website's HTML: