advanced-php icon indicating copy to clipboard operation
advanced-php copied to clipboard

yield 的说明

Open jhdxr opened this issue 7 years ago • 3 comments

yieldsend()会调用next(),而 foreach本身也会调用next(),所以 在 https://github.com/elarity/advanced-php/blob/master/17.%20PHP%E4%B8%AD%E7%9A%84yield%EF%BC%88%E4%B8%8A%EF%BC%89.md 中最后提到的行为是预期行为,并不是一个bug

https://3v4l.org/lvAuH ,其实在foreach中打一个分割线出来就很明显了

jhdxr avatar Nov 08 '18 03:11 jhdxr

自从github不支持fx56以后它就变得很难用 orz

jhdxr avatar Nov 08 '18 03:11 jhdxr

yes!这个问题我已经get到了,foreach后会触发一次next!

elarity avatar May 25 '19 05:05 elarity

哦我只是提一下以防有人被这误导。。。

jhdxr avatar May 25 '19 17:05 jhdxr