summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/yield_from_deep_recursion.phpt
blob: f6d6c3e79fa4957b4b7dfa44998155d4f71d8655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--TEST--
Deep recursion with yield from
--FILE--
<?php
ini_set("memory_limit", "512M");

function from($i) {
    yield $i;
}

function gen($i = 0) {
    if ($i < 50000) {
        yield from gen(++$i);
    } else {
        yield $i;
        yield from from(++$i);
    }
}

foreach (gen() as $v) {
    var_dump($v);
}
?>
--EXPECT--
int(50000)
int(50001)