autoloading methods

[email protected] (Atif Ghaffar) Tue, 30 May 2000 01:30:33 +0200
Newsgroups php.version4
Message-ID <[email protected]>
Just a little php question.
I know its not the place to ask but I will be thankful if you can help
me.

How does method autoloading works in php.
for example if I call 
$lang->hello;
if the method hello does not exists then some other function can take
this argument and return a value according to that. For example make a
lookup in the data base etc.

Thanks


in perl I would do something like this.


package Dictionary;
sub new {my $self=shift; return bless {}, $self;};

sub AUTOLOAD{
        my $self=shift;
        my $name=$AUTOLOAD;
        $name=~s/.*://;
        return "You tried to access $name";
}

package main;
my $obj=Dictionary->new();
print $obj->test;

#this will print
You tried to access test





-- 
Atif Ghaffar
I*Net/Unix Consultant
--------------------------------------
Internet : http://aghaffar.developer.ch
WAP      : http://www.wapdrive.net/aghaffar
Email    : [email protected]