1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 16:38:25 +02:00
Files
Larry Garfield 1c09c0c832 RFC: Pipe operator (#17118)
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-06-10 09:59:43 +02:00

31 lines
367 B
PHP

--TEST--
Generators
--FILE--
<?php
function producer(): \Generator {
yield 1;
yield 2;
yield 3;
}
function map_incr(iterable $it): \Generator {
foreach ($it as $val) {
yield $val +1;
}
}
$result = producer() |> map_incr(...) |> iterator_to_array(...);
var_dump($result);
?>
--EXPECT--
array(3) {
[0]=>
int(2)
[1]=>
int(3)
[2]=>
int(4)
}