Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Issue with list(), ArrayAccess and yield. https://bugs.php.net/bug.php?id=66041
<?php
function dumpFirstElementOfYield() {
list($value) = yield;
var_dump($value);
};
$fixedArray = new SplFixedArray(1);
$fixedArray[0] = 'the element';
$generator = dumpFirstElementOfYield();
$generator->send($fixedArray);
<?php
function dumpFirstElementOfYield() {
list($value) = $ASSIGN_TO_VARIABLE_INSIDE_GENERATOR = yield;
var_dump($value);
};
$fixedArray = new SplFixedArray(1);
$fixedArray[0] = 'the element';
$generator = dumpFirstElementOfYield();
$generator->send($fixedArray);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.