1--TEST-- 2Generator hook 3--FILE-- 4<?php 5 6class A { 7 public $backed = 2 { 8 get { 9 yield 1; 10 yield $this->backed; 11 yield 3; 12 } 13 } 14 15 public $virtual { 16 get { 17 yield 1; 18 yield 2; 19 yield 3; 20 } 21 } 22} 23 24$a = new A(); 25var_dump(iterator_to_array($a->backed)); 26var_dump(iterator_to_array($a->virtual)); 27 28?> 29--EXPECT-- 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} 46