Posted by Meiγo on 11/18/05 13:01
> In PHP5, there is the "static" keyword. What exactly is the difference
> between
>
> class myLib { public static function myFunc() { /* do stuff */ } }
> class myLib { public function myFunc() { /* do stuff */ } }
in this first case the function myFunc() will be available without
instantiation.
then you can call
myLib::myFunc()
second case you can't
In PHP 4 it didn't matter, you could always (?) call a function
staticly
which may lead to strange results (maybe the function used a variable
which hasn't been initialized).
Now in PHP 5 we have static
MeiΓ£o
Navigation:
[Reply to this message]
|