1--TEST-- 2Array offsets can be yielded by reference 3--FILE-- 4<?php 5 6function &gen(array &$array) { 7 yield $array[0]; 8} 9 10$array = [1, 2, 3]; 11$gen = gen($array); 12foreach ($gen as &$val) { 13 $val *= -1; 14} 15var_dump($array); 16 17?> 18--EXPECT-- 19array(3) { 20 [0]=> 21 &int(-1) 22 [1]=> 23 int(2) 24 [2]=> 25 int(3) 26} 27