1--TEST-- 2Precedence of yield and arrow operators 3--FILE-- 4<?php 5 6function gen() { 7 yield "a" . "b"; 8 yield "a" or die; 9 yield "k" => "a" . "b"; 10 yield "k" => "a" or die; 11 var_dump([yield "k" => "a" . "b"]); 12 yield yield "k1" => yield "k2" => "a" . "b"; 13 yield yield "k1" => (yield "k2") => "a" . "b"; 14 var_dump([yield "k1" => yield "k2" => "a" . "b"]); 15 var_dump([yield "k1" => (yield "k2") => "a" . "b"]); 16} 17 18$g = gen(); 19for ($g->rewind(), $i = 1; $g->valid(); $g->send($i), $i++) { 20 echo "{$g->key()} => {$g->current()}\n"; 21} 22 23?> 24--EXPECT-- 250 => ab 261 => a 27k => ab 28k => a 29k => ab 30array(1) { 31 [0]=> 32 int(5) 33} 34k2 => ab 35k1 => 6 362 => 7 373 => k2 38k1 => 9 3910 => ab 40k2 => ab 41k1 => 12 42array(1) { 43 [0]=> 44 int(13) 45} 4611 => k2 47k1 => 14 48array(1) { 49 [15]=> 50 string(2) "ab" 51} 52