php-src/Zend/tests/arrow_functions/008.phpt
Nikita Popov f3e5bbe6f3 Implement arrow functions
Per RFC: https://wiki.php.net/rfc/arrow_functions_v2

Co-authored-by: Levi Morrison <levim@php.net>
Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
2019-05-02 15:04:03 +02:00

29 lines
407 B
PHP

--TEST--
Yield inside arrow functions
--FILE--
<?php
// This doesn't make terribly much sense, but it works...
$fn = fn() => yield 123;
foreach ($fn() as $val) {
var_dump($val);
}
$fn = fn() => yield from [456, 789];
foreach ($fn() as $val) {
var_dump($val);
}
$fn = fn() => fn() => yield 987;
foreach ($fn()() as $val) {
var_dump($val);
}
?>
--EXPECT--
int(123)
int(456)
int(789)
int(987)