1--TEST-- 2Basic test if yield from works 3--FILE-- 4<?php 5function from() { 6 yield "from" => 1; 7 yield 2; 8} 9 10function gen() { 11 yield "gen" => 0; 12 yield from from(); 13 yield 3; 14} 15 16/* foreach API */ 17foreach (gen() as $k => $v) { 18 var_dump($k, $v); 19} 20 21/* iterator API */ 22for ($gen = gen(); $gen->valid(); $gen->next()) { 23 var_dump($gen->key(), $gen->current()); 24} 25?> 26--EXPECT-- 27string(3) "gen" 28int(0) 29string(4) "from" 30int(1) 31int(0) 32int(2) 33int(0) 34int(3) 35string(3) "gen" 36int(0) 37string(4) "from" 38int(1) 39int(0) 40int(2) 41int(0) 42int(3) 43