method_static_var.phpt 348 B

123456789101112131415161718192021222324
  1. --TEST--
  2. Initial value of static var in method depends on the include time of the class definition
  3. --FILE--
  4. <?php
  5. class Foo {
  6. public static function test() {
  7. static $i = 0;
  8. var_dump(++$i);
  9. }
  10. }
  11. Foo::test();
  12. eval("class Bar extends Foo {}");
  13. Foo::test();
  14. Bar::test();
  15. Bar::test();
  16. ?>
  17. --EXPECT--
  18. int(1)
  19. int(2)
  20. int(3)
  21. int(4)