On 10/18/07, Stut <stuttle@xxxxxxxxx> wrote: > > Joshua Bacher wrote: > >> 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? > > In that case you need a new foo. That's the only way you're going to > reset the internal static if the API doesn't give you a way to do it. > > $f=new foo(); > $f->bar(); > $f->bar(); > $g=new foo(); > $g->bar(); this doesnt work: nathan@devel ~/working/www/siuConference $ php testScript.php FUBeyondAllR already defined already defined already defined -nathan