Re: Re: self:: vs this

From: Date: Fri, 11 May 2007 17:28:30 +0000
Subject: Re: Re: self:: vs this
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-254813@lists.php.net to get a copy of this message
On 5/11/07, M.Sokolewicz <tularis@php.net> wrote:
statically: Class Foo {
    static $a = 1;
    static function Bar() {
       self::a++;
    }
} echo Foo:a;
1
Foo::Bar(); // will probably throw a warning, not sure of that though echo Foo:a;
1 (no change)
I'm not sure I understand what you mean by this. This code works: Class Foo { static $a = 1; static function Bar() {
     self::$a++;
     var_dump(self::$a);
} static function Meh() { self::$a='asdf'; var_dump(self::$a); } } Foo::Bar(); Foo::Bar(); Foo::Bar(); Foo::Meh(); ----- output ---- int 2 int 3 int 4 string 'asdf' (length=4)

« previous php.general (#254813) next »