Re: Re: Function Cache
| From: | Sterling Hughes | Date: | Mon, 11 Dec 2000 09:53:09 +0000 |
| Subject: | Re: Re: Function Cache | ||
| References: | 1 2 3 4 5 | Groups: | php.dev php.pear |
| Request: | Send a blank email to php-dev+get-40801@lists.php.net to get a copy of this message | ||
> Sterling Hughes wrote:
> >
> > I've have some similair functionality (id est, Perl's AUTOLOAD) for my own
> > development. I was going to propose it when I had more time, but ah well,
> > AUTOLOAD.
> >
> > Basically what this functionality would allow is that you define a function
that
> > then catches as missed function calls. The autoload variable would also
contain
> > the name of the missing function, ie:
> >
> > class wrapper
> > {
> > function AUTOLOAD()
> > {
> > global $AUTOLOAD;
> > $args = func_get_args();
> >
> > print "$AUTOLOAD was called with: ";
> > var_dump($args);
> > }
> > }
> >
> > $wrap = new wrapper;
> >
> > $wrap->hello("woohooo!");
> >
> > would call the AUTOLOAD function with one argument (woohooo!) and the global
> > variable $AUTOLOAD would contain "hello".
>
> The way I see it, don't get the real payoff of autoloading until you can
> autoload the classes themselves.
>
Come again, I don't quite understand you meaning. do you mean:
class AUTOLOAD
{
function AUTOLOAD($class, $funcname)
{
print "$class [$funcname]: ";
var_dump(func_get_args());
}
}
$obj = new Mike($hello);
would print out
Mike [Mike]: The contents of $hello
??
-Sterling