1--TEST-- 2Behavior of static variables in trait methods 3--FILE-- 4<?php 5 6trait T { 7 public static function counter() { 8 static $i = 0; 9 var_dump(++$i); 10 } 11} 12 13class C1 { 14 use T { 15 T::counter as counter1; 16 T::counter as counter2; 17 } 18} 19 20class C2 { 21 use T; 22} 23 24C1::counter(); 25C1::counter1(); 26C1::counter2(); 27C2::counter(); 28 29C1::counter(); 30C1::counter1(); 31C1::counter2(); 32C2::counter(); 33 34?> 35--EXPECT-- 36int(1) 37int(1) 38int(1) 39int(1) 40int(2) 41int(2) 42int(2) 43int(2) 44