Put something in
A generator that receives values through send() instead of handing them out.
<?phpfunction logger() { echo 'ready' . PHP_EOL; while (true) { $line = yield; echo "log: $line" . PHP_EOL; }}$log = logger();$log->current();$log->send('a');$log->send('b');echo 'end' . PHP_EOL;1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…
- 3…
- 4…