rfc:spread_operator_for_array

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:spread_operator_for_array [2019/04/05 13:35] – more example jhdxrrfc:spread_operator_for_array [2019/04/05 14:10] – more example jhdxr
Line 36: Line 36:
 } }
 $arr6 = [...getArr(), 'c']; //['a', 'b', 'c'] $arr6 = [...getArr(), 'c']; //['a', 'b', 'c']
 +
 +$arr7 = [...new ArrayIterator(['a', 'b', 'c'])]; //['a', 'b', 'c']
 +
 +function arrGen() {
 + for($i = 11; $i < 15; $i++) {
 + yield $i;
 + }
 +}
 +$arr8 = [...arrGen()]; //[11, 12, 13, 14]
 </code> </code>
  
rfc/spread_operator_for_array.txt · Last modified: 2019/05/13 12:45 by nikic