©
本文档使用
php.cn手册 发布
(No version information available, might only be in Git)
Generator 是从 generators返回的.
Generator 对象不能通过 new 实例化.
$value
)$exception
)[#1] dejiakala at gmail dot com [2014-10-06 04:18:12]
<?php
function sayHello($people) {
foreach($people as $person) {
yield "hello " . $person;
}
}
var_dump(sayHello(array('foo', 'bar', 'baz')));
?>
Output:
class Generator#1 (0) {
}