Re: Re: self:: vs this
| From: | Eric Butera | 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 {I'm not sure I understand what you mean by this. This code works: Class Foo { static $a = 1; static function Bar() {static $a = 1; static function Bar() { self::a++; }} echo Foo:a;Foo::Bar(); // will probably throw a warning, not sure of that though echo Foo:a;11 (no change)
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)