Usually I'm not confused about language constructs, but I can't make heads or tails of what's going on here.

```
<?php

function action() {
    for($i=0; $i<10; ++$i) {
        $ans = (yield expensive($i));
        echo "action $ans\n";
    }
}

function expensive($i) {
    return $i*2;
}

$gen = action();
foreach($gen as $x) {
    echo "loop $x\n";
    $gen->send($x);
}

```

Prints:

```
loop 0
action 0
action 
loop 4
action 4
action 
loop 8
action 8
action 
loop 12
action 12
action 
loop 16
action 16
action 

```

So every 2nd iteration of my loop is skipped, and I'm getting `NULL` for `$ans` periodically. What??

I thought `$ans` would receive the result of [`$gen->send`](http://php.net/manual/en/generator.send.php), and if I didn't send anything before the next `yield`, *then* `$ans` would be null, but I always send something on each iteration, so what's is going on here?