@ 2018-05-10T13:51:15Z <?php
function gen()
{
foreach(['first value', 'second value', 'third value'] as $val)
{
yield $val;
}
}
list($first, $second, $third) = gen();
var_dump($first, $second, $third);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.1.0 - 7.1.25 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.26 , 8.4.1 - 8.4.13 Fatal error: Uncaught Error: Cannot use object of type Generator as array in /in/rY3B9:11
Stack trace:
#0 {main}
thrown in /in/rY3B9 on line 11
Process exited with code 255 . preferences:dark mode live preview ace vim emacs key bindings
100.75 ms | 408 KiB | 5 Q