<?php
function baz(){
yield 1;
yield 2;
yield 3;
yield 4;
return yield 5;
}
$f = baz();
foreach($f as $x) {
$f->send(42);
}
var_dump($f->getReturn());
- Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- int(42)
- Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.21
- Parse error: syntax error, unexpected '5' (T_LNUMBER) in /in/6cuPE on line 8
Process exited with code 255.
preferences:
160.98 ms | 402 KiB | 213 Q