TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
401 B
24 lines
401 B
--TEST--
|
|
generator functions via Fiber iterator
|
|
--FILE--
|
|
<?php
|
|
|
|
function gen_values(int $start): iterable
|
|
{
|
|
yield 'a' => $start;
|
|
yield 'b' => $start + 1;
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
$gen = gen_values(10);
|
|
var_dump($gen instanceof Iterator);
|
|
foreach ($gen as $key => $value) {
|
|
var_dump($key . ':' . $value);
|
|
}
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
string(4) "a:10"
|
|
string(4) "b:11"
|
|
|