note 42174 added to keyword.paamayim-nekudotayim
| From: | tango23 at inbox dot lv | Date: | Thu, 06 May 2004 11:20:02 +0000 |
| Subject: | note 42174 added to keyword.paamayim-nekudotayim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69274@lists.php.net to get a copy of this message | ||
>> That's how to make class' static variable in PHP4.
Note, that nobody seems to have a way of actually making a global static server-wide object in PHP.
All the static/class var ways above work only within a single PHP page.
If you want to do something like:
class Logger
{
...
function Logger($filepath)
...
}
in some global include file:
$logobj = new Logger("mylogfile");
and then in all of your pages:
$logobj->log("my message");
and there is no way you can make this logobj static (such that all your pages can refer to without
making unncecessary copies).
Can't be done with using uninstantiated Logger::log() funcs either, because you are not setting
the logfile filepath parameter anywhere persistent.
The only kludge seems to be to use the filepath as a global variable and use Logger:: syntax.
----
Manual Page -- http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42174
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42174&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42174&report=yes
Search -- http://master.php.net/manage/user-notes.php