mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
22 lines
277 B
PHP
22 lines
277 B
PHP
--TEST--
|
|
yielding values from an array
|
|
--FILE--
|
|
<?php
|
|
function from() {
|
|
yield 0;
|
|
yield from []; // must not yield anything
|
|
yield from [1,2];
|
|
}
|
|
|
|
function gen() {
|
|
yield from from();
|
|
}
|
|
|
|
foreach(gen() as $v) {
|
|
var_dump($v);
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
int(0)
|
|
int(1)
|
|
int(2)
|