by Amakanski · 1y ago · 0 comments
There is however the 'yield from' statement.
$a = 5;
$b = fn ($c) => $a * $b;
print($b(2)); // 10
print($b(4)); // 20 function numbers() {
yield from [1,2,3];
yield from [4,5,6];
};
foreach (numbers() as $k => $v) { echo "$k => $v\n"; }
0 => 1
1 => 2
2 => 3
0 => 4
1 => 5
2 => 6It's literally in the interface.