Re: RE:Class::? - accessing data, no success...
| From: | Stanislav Malyshev | Date: | Wed, 05 Jul 2000 12:58:04 +0000 |
| Subject: | Re: RE:Class::? - accessing data, no success... | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-23562@lists.php.net to get a copy of this message | ||
KK>> The class C could have some class variables c1, c2, c3.
What is "class variable"? How is it different from globals?
KK>> $C::c1 = "something";
KK>> $C::c2 = 17;
Does this change it in all instances of class C? If so, I fear there's no
good way to do it in PHP.
KK>> be inconsistent. It should be orthogonal, thus the syntax
KK>> should me
KK>>
KK>> $C::cm1();
KK>> ...
KK>>
KK>> to call class methods, if possible.
No. $var() means "take name from var, and call method by this name".
KK>> A class method is a method that can be called without having
KK>> an instance of that class. This method should not be able to
KK>> use instance methods, as there is no instance. It should not
KK>> be able to use instance variables, for the same reason. It
Using such a method looks like a bad hack to me. Why to have a class if
you don't instantiate it? Just to call it a "class"? Call it "utility
library" and leave classes alone.
KK>> useful, as there will be less references to the hardcoded
KK>> classname in the code - the class name should be used only
KK>> in one place, the class definition "class <name>" or
KK>> "class <name> extends <name'>".
I know a thing less then 1. It's 0.
--
Stanislav Malyshev stas@zend.com
+972-3-6139665