summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/recursive_yield_from.phpt
blob: dbf2c948eab941f562810c2f1185437929374026 (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
27
28
29
30
31
32
33
34
--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)