1--TEST-- 2Basic array unpacking 3--FILE-- 4<?php 5$array = [1, 2, 3]; 6 7function getArr() { 8 return [4, 5]; 9} 10 11function arrGen() { 12 for($i = 11; $i < 15; $i++) { 13 yield $i; 14 } 15} 16 17var_dump([...[]]); 18var_dump([...[1, 2, 3]]); 19var_dump([...$array]); 20var_dump([...getArr()]); 21var_dump([...arrGen()]); 22var_dump([...new ArrayIterator(['a', 'b', 'c'])]); 23 24var_dump([0, ...$array, ...getArr(), 6, 7, 8, 9, 10, ...arrGen()]); 25var_dump([0, ...$array, ...$array, 'end']); 26 27--EXPECT-- 28array(0) { 29} 30array(3) { 31 [0]=> 32 int(1) 33 [1]=> 34 int(2) 35 [2]=> 36 int(3) 37} 38array(3) { 39 [0]=> 40 int(1) 41 [1]=> 42 int(2) 43 [2]=> 44 int(3) 45} 46array(2) { 47 [0]=> 48 int(4) 49 [1]=> 50 int(5) 51} 52array(4) { 53 [0]=> 54 int(11) 55 [1]=> 56 int(12) 57 [2]=> 58 int(13) 59 [3]=> 60 int(14) 61} 62array(3) { 63 [0]=> 64 string(1) "a" 65 [1]=> 66 string(1) "b" 67 [2]=> 68 string(1) "c" 69} 70array(15) { 71 [0]=> 72 int(0) 73 [1]=> 74 int(1) 75 [2]=> 76 int(2) 77 [3]=> 78 int(3) 79 [4]=> 80 int(4) 81 [5]=> 82 int(5) 83 [6]=> 84 int(6) 85 [7]=> 86 int(7) 87 [8]=> 88 int(8) 89 [9]=> 90 int(9) 91 [10]=> 92 int(10) 93 [11]=> 94 int(11) 95 [12]=> 96 int(12) 97 [13]=> 98 int(13) 99 [14]=> 100 int(14) 101} 102array(8) { 103 [0]=> 104 int(0) 105 [1]=> 106 int(1) 107 [2]=> 108 int(2) 109 [3]=> 110 int(3) 111 [4]=> 112 int(1) 113 [5]=> 114 int(2) 115 [6]=> 116 int(3) 117 [7]=> 118 string(3) "end" 119} 120