Re: Static variable in a class method

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

 



Nathan Nobbe schreef:
On Thu, Feb 14, 2008 at 6:37 AM, Jochem Maas <jochem@xxxxxxxxxxxxx> 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 member will
exhibit the
same behaviour, only the scope is different.

you can find the
doc on static variables here,
http://www.php.net/manual/en/language.variables.scope.php
im not sure if their behavior is well defined when they are used in
classes,
or objects.
behaviour is indentical to usage inside standalone functions.


thats a gamble since there is no description of how the static keyword
behaves inside class member functions.  i for one will stick to static class
variables and instance variables, and avoid this static variable feature
altogether.

they work the same because they are the same thing. no gamble. nada.


-nathan


--
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