Morgan L. Owens wrote:
As I wrote in an earlier post:

On 2012-08-09 15:30, Morgan L. Owens wrote:
 > I for one am lazy, and would much prefer writing:
 > <?php
 > function append_iterator($first, $second)
 > {
 >    foreach($first as $i)
 >    {
 >        yield $i;
 >    }
 >    foreach($second as $i)
 >    {
 >        yield $i;
 >    }
 > }
 > ?>

Morgan

I think THIS is an nice example of why I am having a problem with the concept.
EXACTLY what is yield doing here?
If this was an SQL procedure, then at the first yield (suspend in SQL), the procedure returns the values and the external process uses them. Next call to the procedure returns the next set of values. In your example you have TWO 'suspend' points, and this is what is making things confusing for me. SO is this returning every $first value followed by every $second ? Without some better explanation of how the work flows, reading and understanding even what the above example means is a problem? The answer may be simple but people telling me 'just because you don't understand is no reason to reject them' is just irritating. I'd LIKE to understand what they are intended to provide but I'm still just not getting it as hopefully the explanation here highlights?
I'm sure I'm not alone here?

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to