mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
9a1da9f61f
RFC: https://wiki.php.net/rfc/static_variable_inheritance Closes GH-6719.
25 lines
348 B
PHP
25 lines
348 B
PHP
--TEST--
|
|
Initial value of static var in method depends on the include time of the class definition
|
|
--FILE--
|
|
<?php
|
|
|
|
class Foo {
|
|
public static function test() {
|
|
static $i = 0;
|
|
var_dump(++$i);
|
|
}
|
|
}
|
|
|
|
Foo::test();
|
|
eval("class Bar extends Foo {}");
|
|
Foo::test();
|
|
|
|
Bar::test();
|
|
Bar::test();
|
|
?>
|
|
--EXPECT--
|
|
int(1)
|
|
int(2)
|
|
int(3)
|
|
int(4)
|