On Fri, 2002-12-06 at 22:11, Stig S. Bakken wrote: > It won't be different in ZE2. This is not a bug though, but a tricky > design issue. The problem is figuring out at runtime when to set $this > or not in a method. What most people would probably find intuitive, is > that $this was set only in methods called in the object, but this would > require pretty expensive checks for every method call.
Maybe the roots of OO is my problem. PHP does similar, but not exactly. I don't know whether you like clear things, or is this clear to you, but I see confusion about handling $this. Excerpt from the documentation: http://www.php.net/manual/en/language.oop.php Within a class definition, you do not know under which name the object will be accessible in your program: at the time the Cart class was written, it was unknown that the object will be named $cart or $another_cart later. Thus, you cannot write $cart->items within the Cart class itself. Instead, in order to be able to access it's own functions and variables from within a class, one can use the pseudo-variable $this which can be read as 'my own' or 'current object'. Thus, '$this->items[$artnr] += $num' can be read as 'add $num to the $artnr counter of my own items array' or 'add $num to the $artnr counter of the items array within the current object'. > Andi can shed more light on this if needed. Andi, please tell me why. -- jul -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php