Re: static variables inside static methods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/7/6 Дмитрий Степанов <dmitrij@xxxxxxxxxxx>

> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux