Re: call_user_func
| From: | Charles Killian | Date: | Mon, 31 Jul 2000 21:16:26 +0000 |
| Subject: | Re: call_user_func | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9281@lists.php.net to get a copy of this message | ||
If it's not in the current docs here's what it says in the manual snap shot:
(I haven't used this function yet so I don't know if it works)
call_user_method
(PHP3 >= 3.0.3, PHP4 )
call_user_method -- Call a user method on an specific object
Description
mixed call_user_method (string method_name, object obj [, mixed parameter [,
mixed ...]])
Calls a the method referred by method_name from the user defined obj object.
An example of usage is below, where we define a class, instantiate an object
and use call_user_method() to call indirectly its print_info method.
<?php
class Country {
var $NAME;
var $TLD;
function Country($name, $tld) {
$this->NAME = $name;
$this->TLD = $tld;
}
function print_info($prestr="") {
echo $prestr."Country: ".$this->NAME."\n";
echo $prestr."Top Level Domain: ".$this->TLD."\n";
}
}
$cntry = new Country("Peru","pe");
echo "* Calling the object method directly\n";
$cntry->print_info();
echo "\n* Calling the same method indirectly\n";
call_user_method ("print_info", $cntry, "\t");
?>
----- Original Message -----
From: "Lars Wilhelmsen" <lw@ez.no>
To: <php-general@lists.php.net>
Sent: Monday, July 31, 2000 2:00 PM
Subject: RE: [PHP] call_user_func
> Excuse me - but where is that function documented?
>
> --
> Lars Wilhelmsen <lw@ez.no>, developer @ eZ systems <www.ez.no>
>
> -----Original Message-----
> From: Charles Killian [mailto:Charles@AlcatrazDesignGroup.com]
> Sent: 31. juli 2000 22:56
> To: Lars Wilhelmsen; php-general@lists.php.net
> Subject: Re: [PHP] call_user_func
>
>
> Try call_user_method().
>
> Charles
>
>
> ----- Original Message -----
> From: "Lars Wilhelmsen" <lw@ez.no>
> To: <php-general@lists.php.net>
> Sent: Monday, July 31, 2000 1:52 PM
> Subject: [PHP] call_user_func
>
>
> > Hi.
> >
> > I'm trying to use the call_user_func() inside another function to call
> > a "static" function in a class; someClass::foo()
> >
> > But the call_user_func() reports that the function is not found.
> >
> > Doesn't the function work with class functions?
> >
> > Regards,
> > -larsw-
> >
> > --
> > Lars Wilhelmsen <lw@ez.no>, developer @ eZ systems <www.ez.no>
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>