- strtoupper: documentation ( source)
<?php
class Pipe
{
var $stderr;
}
function generator_eval(Generator $gen)
{
foreach ($gen as $k => $v) {}
}
function words()
{
foreach (["foo", "bar", "baz"] as $word) {
yield $word;
}
}
function uppercase(Traversable $in, Generator $error)
{
foreach ($in as $word) {
yield strtoupper($word);
}
}
$stderr = function() {
for (;;) {
$error = (yield);
echo "Error! $error\n";
}
};
foreach (uppercase(words(), $stderr()) as $word) {
echo "$word\n";
}