1--TEST-- 2Generators can return non-scalar keys 3--FILE-- 4<?php 5 6function gen() { 7 yield [1, 2, 3] => [4, 5, 6]; 8 yield (object) ['a' => 'b'] => (object) ['b' => 'a']; 9 yield 3.14 => 2.73; 10 yield false => true; 11 yield true => false; 12 yield null => null; 13} 14 15foreach (gen() as $k => $v) { 16 var_dump($k, $v); 17} 18 19?> 20--EXPECT-- 21array(3) { 22 [0]=> 23 int(1) 24 [1]=> 25 int(2) 26 [2]=> 27 int(3) 28} 29array(3) { 30 [0]=> 31 int(4) 32 [1]=> 33 int(5) 34 [2]=> 35 int(6) 36} 37object(stdClass)#3 (1) { 38 ["a"]=> 39 string(1) "b" 40} 41object(stdClass)#4 (1) { 42 ["b"]=> 43 string(1) "a" 44} 45float(3.14) 46float(2.73) 47bool(false) 48bool(true) 49bool(true) 50bool(false) 51NULL 52NULL 53