xref: /PHP-8.0/Zend/tests/method_static_var.phpt (revision 57b0e5a0)
1--TEST--
2Initial value of static var in method depends on the include time of the class definition
3--FILE--
4<?php
5
6/* The current behavior is probably a bug, but we should still test how it currently works. */
7
8class Foo {
9    public static function test() {
10        static $i = 0;
11        var_dump(++$i);
12    }
13}
14
15Foo::test();
16eval("class Bar extends Foo {}");
17Foo::test();
18
19Bar::test();
20Bar::test();
21?>
22--EXPECT--
23int(1)
24int(2)
25int(2)
26int(3)
27