I have an array in php:
$array = [1,2,3];
When I do:
while(yield $array->advance())
I get Call to a member function advance() on array
How do I turn my array into an iterator?
You can call ->advance()
only on instances of Amp\\Iterator
.
So you need to convert your basic php array first with the fromIterable
method.
Amp\Iterator\fromIterable($array)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.