diff --git a/t.php b/t.php index e2d53ce..966ce07 100644 --- a/t.php +++ b/t.php @@ -1 +1,48 @@ -hello, test; +foo(); +// } +// } + +// $bar = new Bar(); +// foreach ($bar as $item) { +// var_dump($item); +// } + +function gen() +{ + $i = 1; + while (true) { + yield $i += yield; + echo $i, "\n"; + } +} + +$gen = gen(); +var_dump($gen->send(3)); +$gen->next(); +echo "----\n"; +var_dump($gen->send(4)); +$gen->next(); +echo "----\n"; +$gen->send(5); +$gen->next(); +echo "----\n"; +$gen->send(6); +$gen->next(); +echo "----\n"; +$gen->send(7); +$gen->next(); +echo "----\n"; +