On 5/9/06, D. Dante Lorenso <[EMAIL PROTECTED]> wrote:
As an OOP programmer, I would expect the scope search to be as follows:
1. LOCAL: current method
2. THIS: current instance ($this)
3. SELF: current class & parent classes, in order of inheritance
4. GLOBAL: globals
Ok, so this
D. Dante Lorenso wrote:
...
I mean, I was forced to write 'self ::' like 11 times in that
constructor. THAT is annoying.
would it help to consider that the annoyance is a matter of subjection
rather than fact? ;-)
I realize I am probably just venting since it's unlikely I can get
anything
Richard Lynch wrote:
On Tue, May 9, 2006 12:42 pm, D. Dante Lorenso wrote:#1.
You might do:
define('MY_CONSTANT', true);
class A {
const MY_CONSTANT = MY_CONSTANT;
}
Then you can sort of have the best of both worlds...
Though in a hack sort of way. :-^
Hehe, nice. No thanks ;-) Keep yer s
Richard Lynch wrote:
On Tue, May 9, 2006 4:48 pm, D. Dante Lorenso wrote:
If
the search for my constant follows the search I've listed above, self
would never be necessary unless you wanted to pinpoint "3" directly.
Under this same line of thinking, though, '$this->' really shouldn't
be
be ne
Jochem Maas wrote:
D. Dante Lorenso wrote:
$x = ($y == self :: MY_CONSTANT || $y == self :: MY_CONSTANT2);
I hate the spaces around the '::' whynot self::MY_CONSTANT?
Stupid PHP Eclipse code beautifier ;-) It's what I use to beautify and
since it always does that, I've been forced to accept
On Tue, May 9, 2006 4:48 pm, D. Dante Lorenso wrote:
> If
> the search for my constant follows the search I've listed above, self
> would never be necessary unless you wanted to pinpoint "3" directly.
> Under this same line of thinking, though, '$this->' really shouldn't
> be
> be necessary either
On Tue, May 9, 2006 12:42 pm, D. Dante Lorenso wrote:
> Does anyone know if it's possible to reference class constants or
> static
> variables without having to use 'self::' all the time?
>
> class A {
> const MY_CONSTANT = true;
>
> public function test() {
>echo self :: MY_CONSTAN
D. Dante Lorenso wrote:
John Wells wrote:
On 5/9/06, D. Dante Lorenso <[EMAIL PROTECTED]> wrote:
Does anyone know if it's possible to reference class constants or static
variables without having to use 'self::' all the time?
No, ... Why? The reason is SCOPE.
implicit scope sucks - it mea
D. Dante Lorenso wrote:
As an OOP programmer, I would expect the scope search to be as follows:
1. LOCAL: current method
2. THIS: current instance ($this)
3. SELF: current class & parent classes, in order of inheritance
4. GLOBAL: globals
Actually, 2 and 3 are really the same but only v
John Wells wrote:
On 5/9/06, D. Dante Lorenso <[EMAIL PROTECTED]> wrote:
Does anyone know if it's possible to reference class constants or static
variables without having to use 'self::' all the time?
No, ... Why? The reason is SCOPE.
As wonderful as PHP is, it can't read your mind. So if you'
On 5/9/06, D. Dante Lorenso <[EMAIL PROTECTED]> wrote:
Does anyone know if it's possible to reference class constants or static
variables without having to use 'self::' all the time?
No, and the answer is actually in your example. Copy-and-paste all of
your example code into one file, and just
11 matches
Mail list logo