an example:
$coroutine=call_user_func(create_function('', <<<'fun_code'
echo "inner 1:\n";
$rtn=(yield 'yield1');
echo 'inner 2:';var_export($rtn);echo "\n";
$rtn=(yield 'yield2');
echo 'inner 3:';var_export($rtn);echo "\n";
$rtn=(yield 'yield3');
echo 'inner 4:';var_export($rtn);echo "\n";
fun_code
));
echo ":outer 1\n"; // :outer 1
var_export($coroutine->current());echo ":outer 2\n"; // inner 1:, 'yield1':outer 2
var_export($coroutine->current());echo ":outer 3\n"; // 'yield1':outer 3
var_export($coroutine->next());echo ":outer 4\n"; // inner 2:NULL, NULL:outer 4
var_export($coroutine->current());echo ":outer 5\n"; // 'yield2':outer 5
var_export($coroutine->send('jack'));echo ":outer 6\n"; // inner 3:'jack', 'yield3':outer 6
var_export($coroutine->current());echo ":outer 7\n"; // 'yield3':outer 7
var_export($coroutine->send('peter'));echo ":outer 8\n"; // inner 4:'peter', NULL:outer 8