Re: [PHP] Static variable in a class method

2008-02-14 Thread Richard Lynch
On Thu, February 14, 2008 5:14 pm, Stut wrote: > I'm only guessing, but instead of classes I would expect you to have a > fair few files that contain lots of functions, correct? No, just one file with a handful to a dozen functions, really... If the site is designed correctly, each page is doing

Re: [PHP] Static variable in a class method

2008-02-14 Thread Stut
Richard Lynch wrote: On Thu, February 14, 2008 4:28 pm, Stut wrote: Richard Lynch wrote: If a website is complicated enough to need a class hierarchy, then something is wrong in your Design. :-) :-) :-) I don't think anything ever *needs* a class heirarchy, but I wouldn't say using one indicat

Re: [PHP] Static variable in a class method

2008-02-14 Thread Richard Lynch
On Thu, February 14, 2008 4:28 pm, Stut wrote: > Richard Lynch wrote: >> If a website is complicated enough to need a class hierarchy, then >> something is wrong in your Design. :-) :-) :-) > > I don't think anything ever *needs* a class heirarchy, but I wouldn't > say using one indicates a design

Re: [PHP] Static variable in a class method

2008-02-14 Thread Stut
Richard Lynch wrote: If a website is complicated enough to need a class hierarchy, then something is wrong in your Design. :-) :-) :-) I don't think anything ever *needs* a class heirarchy, but I wouldn't say using one indicates a design flaw. Classes themselves are an invaluable tool for cr

Re: [PHP] Static variable in a class method

2008-02-14 Thread Robert Cummings
On Thu, 2008-02-14 at 15:21 -0500, Eric Butera wrote: > On Thu, Feb 14, 2008 at 3:07 PM, Richard Lynch <[EMAIL PROTECTED]> wrote: > > On Thu, February 14, 2008 11:10 am, Eric Butera wrote: > > > Just FYI the static keyword was quite popular in PHP4 for the > > > singleton pattern. You could do

Re: [PHP] Static variable in a class method

2008-02-14 Thread Eric Butera
On Thu, Feb 14, 2008 at 3:07 PM, Richard Lynch <[EMAIL PROTECTED]> wrote: > On Thu, February 14, 2008 11:10 am, Eric Butera wrote: > > Just FYI the static keyword was quite popular in PHP4 for the > > singleton pattern. You could do something like: > > I have used and will continue to use the s

Re: [PHP] Static variable in a class method

2008-02-14 Thread Zoltán Németh
2008. 02. 14, csütörtök keltezéssel 14.07-kor Richard Lynch ezt írta: > On Thu, February 14, 2008 11:10 am, Eric Butera wrote: > > Just FYI the static keyword was quite popular in PHP4 for the > > singleton pattern. You could do something like: > > I have used and will continue to use the static

Re: [PHP] Static variable in a class method

2008-02-14 Thread Richard Lynch
On Thu, February 14, 2008 11:10 am, Eric Butera wrote: > Just FYI the static keyword was quite popular in PHP4 for the > singleton pattern. You could do something like: I have used and will continue to use the static keyword in functions, and will most likely never use a class in PHP... If a web

Re: [PHP] Static variable in a class method

2008-02-14 Thread Nathan Rixham
Nathan Nobbe wrote: On Thu, Feb 14, 2008 at 12:10 PM, Eric Butera <[EMAIL PROTECTED]> wrote: On Thu, Feb 14, 2008 at 9:50 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <[EMAIL PROTECTED]> wrote: > Nathan Nobbe schreef: what you are using is poten

Re: [PHP] Static variable in a class method

2008-02-14 Thread Nathan Nobbe
On Thu, Feb 14, 2008 at 12:10 PM, Eric Butera <[EMAIL PROTECTED]> wrote: > On Thu, Feb 14, 2008 at 9:50 AM, Nathan Nobbe <[EMAIL PROTECTED]> > wrote: > > On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <[EMAIL PROTECTED]> > wrote: > > > > > Nathan Nobbe schreef: > > > > > > what you are using is pot

Re: [PHP] Static variable in a class method

2008-02-14 Thread Eric Butera
On Thu, Feb 14, 2008 at 9:50 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <[EMAIL PROTECTED]> wrote: > > > Nathan Nobbe schreef: > > > > what you are using is potentially not what you think it is. you are > > using > > > a 'static variable' which is

Re: [PHP] Static variable in a class method

2008-02-14 Thread Jochem Maas
Nathan Nobbe schreef: On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <[EMAIL PROTECTED]> wrote: Nathan Nobbe schreef: what you are using is potentially not what you think it is. you are using a 'static variable' which is not a static class member. actually it pretty much *is* the same - the

Re: [PHP] Static variable in a class method

2008-02-14 Thread Nathan Nobbe
On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <[EMAIL PROTECTED]> wrote: > Nathan Nobbe schreef: > > what you are using is potentially not what you think it is. you are > using > > a 'static variable' which is not a static class member. > > actually it pretty much *is* the same - the static class

Re: [PHP] Static variable in a class method

2008-02-14 Thread Jochem Maas
Nathan Nobbe schreef: On Feb 13, 2008 8:44 PM, Nirmalya Lahiri <[EMAIL PROTECTED]> wrote: --- Pauau <[EMAIL PROTECTED]> wrote: I have a class method which declares a static variable within.However, across all the instances of the class, the current value on that variable replicates. Is it the

Re: [PHP] Static variable in a class method

2008-02-14 Thread Jochem Maas
Pauau schreef: I have a class method which declares a static variable within.However, across all the instances of the class, the current value on that variable replicates. Is it the intended functionality? Example: class A {public function foo() {static $i=0;$i++;}}$obj1

Re: [PHP] Static variable in a class method

2008-02-13 Thread Nathan Nobbe
On Feb 13, 2008 8:44 PM, Nirmalya Lahiri <[EMAIL PROTECTED]> wrote: > --- Pauau <[EMAIL PROTECTED]> wrote: > > > I have a class method which declares a static variable > > within.However, > > across all the instances of the class, the current value on that > > variable > > replicates. Is it the in

Re: [PHP] Static variable in a class method

2008-02-13 Thread Nirmalya Lahiri
--- Pauau <[EMAIL PROTECTED]> wrote: > I have a class method which declares a static variable > within.However, > across all the instances of the class, the current value on that > variable > replicates. Is it the intended functionality? Example: class A { > public > function foo() {

[PHP] Static variable in a class method

2008-02-13 Thread Pauau
I have a class method which declares a static variable within.However, across all the instances of the class, the current value on that variable replicates. Is it the intended functionality? Example: class A {public function foo() {static $i=0;$i++;}}$obj1 = new A();$obj