Date: 05/22/01
- Next message: sniper <email protected>: "[PHP-DEV] Bug #11029 Updated: mysql_connect doesn't work"
- Previous message: leo <email protected>: "[PHP-DEV] Bug #11014 Updated: Can't build PDFlib with PHP successfully"
- In reply to: Ulf Wendel: "[PHP-DEV] Bug or undocumented feature: static?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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: php-dev-unsubscribe <email protected>
>For additional commands, e-mail: php-dev-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: sniper <email protected>: "[PHP-DEV] Bug #11029 Updated: mysql_connect doesn't work"
- Previous message: leo <email protected>: "[PHP-DEV] Bug #11014 Updated: Can't build PDFlib with PHP successfully"
- In reply to: Ulf Wendel: "[PHP-DEV] Bug or undocumented feature: static?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

