Re: Re: Re: [PHP4BETA] Bug: Isn´t it possible to use req uire /include to add methods to classes????
| From: | André Langhorst | Date: | Fri, 12 May 2000 12:08:34 +0000 |
| Subject: | Re: Re: Re: [PHP4BETA] Bug: Isn´t it possible to use req uire /include to add methods to classes???? | ||
| References: | 1 2 3 4 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14911@lists.php.net to get a copy of this message | ||
well, there are others thinking of this as a good idea...
an example where a cache function could be used in almost every class
where unique data is returned on unique function calls with unique paramters.
class test {
require('cache.php'); // This as we had cleared does not work
// Instead a function which replaces itself
// with the content of a file
do_something_too($parm1 [up to] $param6) {
... }
do_layer($param1 ... $param6) {
$this->cache('do_something_too',$param1 [up to] $param6); }
}
// my previous cache function without eval(), working but only
// with calls within the same object, stored in cache.php
function cache () {
$argsarray=func_get_args();
$arg_funct=$argsarray[0];
unset($argsarray[0]);
$arg_param=implode(",",$argsarray);
if (!$this->cache[$arg_funct][$arg_param]) {
$this->cache[$arg_funct][$arg_param]=$this->$arg_funct($arg_param); }
return $this->cache[$arg_funct][$arg_param]; }
andré