<?php class Foo { function test() { static $i = 0; var_dump(++$i); } } $foo = new Foo; $foo->test(); eval("class Bar extends Foo {}"); $foo->test(); /** * function_add_ref() makes a clone of static variables for inherited functions, so $i in Bar::test gets initial value 1 */ $bar = new Bar; $bar->test(); $bar->test();
You have javascript disabled. You will not be able to edit any code.