- var_dump: documentation ( source)
<?php
function printer() {
for ($i = 0; $i < 10; $i++) {
$string = (yield $i);
var_dump($string);
}
}
$printer = printer();
echo 'current: '; var_dump($printer->current());
$printer->send('Hello world!');
echo 'current: '; var_dump($printer->current());
$printer->next();
echo 'current: '; var_dump($printer->current());
$printer->send('Bye world!');
echo 'current: '; var_dump($printer->current());