mirror of
https://github.com/php-win-ext/phpy.git
synced 2026-03-24 08:52:08 +01:00
16 lines
282 B
PHP
16 lines
282 B
PHP
<?php
|
|
/**
|
|
* 简化对PyCore::iter和PyCore::next的使用
|
|
*/
|
|
function iter($res)
|
|
{
|
|
$iter = PyCore::iter($res);
|
|
while (!is_null($value = PyCore::next($iter))) {
|
|
yield $value;
|
|
}
|
|
}
|
|
|
|
foreach (iter(PyCore::range(3)) as $v) {
|
|
echo $v . PHP_EOL;
|
|
}
|