Re: hay
| From: | Richard Lynch | Date: | Sun, 21 Jul 2002 19:40:05 +0000 |
| Subject: | Re: hay | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108746@lists.php.net to get a copy of this message | ||
>Sorry that I write your prov address but it seems to me that you
>are quite like guru in PHP so I would like to share with you with
>my problem and i would be glad to hear from you where and what
>kind of problem there is.
I don't use Classes.
> $this=&$GLOBALS["cache"];
I would not expect this to work.
PHP is going to finalize and return the class, and you're assignment to
$this is meaningless.
If you want this to work, you'll have to do more like this:
<?php
$cache = array();
function new_A();
global $cache;
if (!isset($cache['A'])){
$cache['A'] = new A();
}
return $cache['A'];
}
?>
In other words, keep your cache "external" to the actual object
implementation.
--
Like Music? http://l-i-e.com/artists.htm