Re: Strange behaviour of static declared content.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>     I can't touch the API.
> 
> i have never use static variables inside of functions and likely never will.
> go for static class variables instead :)
> 
> <?php
> class foo{
>         public static $foobar = false;
>         public function bar(){
>                 static $foobar=false;
>                 if (self::$foobar === False){
>                         self::$foobar='FUBeyondAllR';
>                         echo self::$foobar . "\n";
>                 }else{echo "already defined\n";}
>         }
> }
> 
> $f=new foo();
> $f->bar();
> $f->bar();
> foo::$foobar=false;
> $f->bar();
> ?>
> 
> nathan@devel ~/working/www/siuConference $ php testScript.php
> FUBeyondAllR
> already defined
> FUBeyondAllR
> 
> -nathan

thats the solution for the wrong problem. it's not up to me to change
the API. the API is designed like i noted and i need a way to get around
this behaviour.

thanks for your idea any further suggestions?

josh

-- 
--------------------------------
joshua bacher
Max Planck Institute for Evolutionary Anthropology
Deutscher Platz 6
04103 LEIPZIG
Germany
web: http://bacher.bash-it.de
--------------------------------

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux