2011/7/6 Дмитрий Степанов <dmit...@stepanov.lv>

> PHP documentation of static keywords does not unambiguously explain
> behavior
> of "static" variables inside methods in example #1. I believe that in
> example #1 the exactly same instance of function (method) is used
> irregarding of how you call it (X::test() or Y::test()), therefore I would
> expect the same "static" var to be involved in both calls to test().
>

I would also expect a static local variable to be tied to the function that
defines it without regard to how you call it should the function happen to
be static. To me, a static local variable should act like a private global
variable and have exactly one value visible only to its declaring function.

David

Reply via email to