It is supposed to behave like this.
We took the C++ model.

Andi

At 12:13 PM 5/22/2001 +0200, Ulf Wendel wrote:
>Hi,
>
>I stepped into something yesterday I would call an undocumented feature
>or a bug, don't know if I should make a bug report. Here's the snippet:
>
>function bar() {
>   static $j = 0;
>   print ++$j;
>}
>
>class foo {
>
>   function foo() {
>     static $i = 0;
>     print ++$i;
>   }
>
>   function bar() {
>     static $j = 0;
>     print ++$j;
>   }
>
>}
>
>$obj1 = new foo();     => prints 1
>$obj2 = new foo();     => prints 2
>
>$obj1->bar();          => prints 1
>$obj2->bar();          => prints 2
>
>bar();                 => prints 1
>
>
>Looks like the static variable is not bound to the member functions of
>my objects. I expected that member functions from different objects of
>the same type do not share static variables, so that the output would be
>"11111".
>
>Ulf
>
>--
>NetUSE AG              Dr.-Hell-Straße   Fon: +49 431 386 436 00
>http://www.netuse.de/  D-24107 Kiel      Fax: +49 431 386 435 99
>
>PHP lernen? Noch sind Schulungsplätze frei: http://www.netuse.de/
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to