Content deleted Content added
m Add PHP RFC. |
m Add a PHP example |
||
Line 404:
===PHP===
The community of PHP has started an [https://wiki.php.net/rfc/generators RFC about Generator].
<source lang="php">
function fibonacci() {
$last = 0;
$current = 1;
yield 1;
while (true) {
$current = $last + $current;
$last = $current - $last;
yield $current;
}
}
foreach (fibonacci() as $number) {
echo $number . "\n";
}
</php>
==See also==
|