xref: /PHP-7.4/Zend/tests/arrow_functions/008.phpt (revision f3e5bbe6)
1--TEST--
2Yield inside arrow functions
3--FILE--
4<?php
5
6// This doesn't make terribly much sense, but it works...
7
8$fn = fn() => yield 123;
9foreach ($fn() as $val) {
10    var_dump($val);
11}
12
13$fn = fn() => yield from [456, 789];
14foreach ($fn() as $val) {
15    var_dump($val);
16}
17
18$fn = fn() => fn() => yield 987;
19foreach ($fn()() as $val) {
20    var_dump($val);
21}
22
23?>
24--EXPECT--
25int(123)
26int(456)
27int(789)
28int(987)
29