summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/yield_from_deep_recursion.phpt
blob: 8ef3b891299d6496190ca7dccac234ed5f5ebf36 (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)