1--TEST-- 2Hooks containing static variables 3--FILE-- 4<?php 5 6class Test { 7 public $prop { 8 get { 9 static $foo = []; 10 static $count = 1; 11 $foo[] = $count++; 12 return $foo; 13 } 14 } 15} 16 17$test = new Test; 18var_dump($test->prop); 19var_dump($test->prop); 20var_dump($test->prop); 21 22?> 23--EXPECT-- 24array(1) { 25 [0]=> 26 int(1) 27} 28array(2) { 29 [0]=> 30 int(1) 31 [1]=> 32 int(2) 33} 34array(3) { 35 [0]=> 36 int(1) 37 [1]=> 38 int(2) 39 [2]=> 40 int(3) 41} 42