1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 05:21:02 +02:00
Files
archived-php-src/Zend/tests/generators/recursive_yield_from.phpt
2020-02-03 22:52:20 +01:00

34 lines
392 B
PHP

--TEST--
Check if recursion with yield from works
--FILE--
<?php
function from($a = 0) {
yield 1 + $a;
if ($a <= 3) {
yield from from($a + 3);
yield from from($a + 6);
}
yield 2 + $a;
}
function gen() {
yield from from();
}
foreach(gen() as $v) {
var_dump($v);
}
?>
--EXPECT--
int(1)
int(4)
int(7)
int(8)
int(10)
int(11)
int(5)
int(7)
int(8)
int(2)