1--TEST-- 2yield can be used in finally (apart from forced closes) 3--FILE-- 4<?php 5 6function gen() { 7 try { 8 echo "before return\n"; 9 return; 10 echo "after return\n"; 11 } finally { 12 echo "before yield\n"; 13 yield "yielded value"; 14 echo "after yield\n"; 15 } 16 17 echo "after finally\n"; 18} 19 20$gen = gen(); 21var_dump($gen->current()); 22$gen->next(); 23 24?> 25--EXPECTF-- 26before return 27before yield 28string(%d) "yielded value" 29after yield 30