On Aug 17, 2007, at 6:23 AM, Walt Haas wrote:

On Thu, 2007-08-16 at 17:39 -0600, Richard K Miller wrote:
Here's an OOP question that perplexes me. It seems PHP doesn't treat
static variables correctly in child classes
....
WHAT I EXPECTED:
Regular variable in ABC
Static variable in ABC
Regular variable in DEF
Static variable in DEF

ACTUAL OUTPUT:
Regular variable in ABC
Static variable in ABC
Regular variable in DEF
Static variable in ABC <--- This is different from what I expected

Anyone know why?

Actually a better terminology to describe these variables is "class
variables" vs. "instance variables". A static variable is bound to the class definition itself, while a non-static variable gets a new instance
of the variable with each "new" instance of the class.

Yes, those are much more descriptive and helpful to understanding.

By the way, here is the section from a meeting on PHP 6 that mentions their deliberations on late static binding, as Alvaro said:

http://www.php.net/~derick/meeting-notes.html#late-static-binding- using-this-without-or-perhaps-with-a-different-name



_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to