@ 2014-10-07T04:20:37Z <?php
$gen = function ($client, $stream) {
while ($record = yield) {
yield [
'StreamName' => $stream,
'PartitionKey' => 'group' . rand(1, 5),
'Data' => $record,
];
}
};
$records = $gen('things');
while ($records->valid()) {
var_dump($records->current());
$records->next();
}
$records->send('<Record Data>');
$records->send('<Record Data>');
while ($records->valid()) {
var_dump($records->current());
$records->next();
}
$records->send('<Record Data>');
$records->send('<Record Data>');
while ($records->valid()) {
var_dump($records->current());
$records->next();
}
$records->send('<Record Data>');
$records->send('<Record Data>');
$records->send('<Record Data>');
$records->send('<Record Data>');
$records->send('<Record Data>');
$records->send('<Record Data>');
while ($records->valid()) {
var_dump($records->current());
$records->next();
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.1.0 - 7.1.33 , 7.2.0 - 7.2.26 , 7.3.0 - 7.3.13 , 7.4.0 - 7.4.1 Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed in /in/Oq2st on line 13 and exactly 2 expected in /in/Oq2st:3
Stack trace:
#0 /in/Oq2st(13): {closure}('things')
#1 {main}
thrown in /in/Oq2st on line 3
Process exited with code 255 . Output for 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 Warning: Missing argument 2 for {closure}() in /in/Oq2st on line 3
NULL
Output for 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 Parse error: syntax error, unexpected '[' in /in/Oq2st on line 5
Process exited with code 255 . Output for 4.4.2 - 4.4.9 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 Parse error: syntax error, unexpected T_FUNCTION in /in/Oq2st on line 3
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 , 5.0.0 - 5.0.5 Parse error: parse error, unexpected T_FUNCTION in /in/Oq2st on line 3
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error in /in/Oq2st on line 3
Process exited with code 255 . preferences:dark mode live preview
195.14 ms | 401 KiB | 325 Q